-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oscar Apeland
committed
Oct 23, 2017
1 parent
4999579
commit 0f594a2
Showing
18 changed files
with
820 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'SwipeableViewController' | ||
s.version = '0.1.0' | ||
s.summary = 'A small UI component to build UIPageViewController-y views in your app.' | ||
|
||
s.description = <<-DESC | ||
A segmented header and a UIPageViewController all in one convenient package. | ||
DESC | ||
|
||
s.homepage = 'https://github.com/tiseoslo/SwipeableViewController' | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.author = { 'Oscar Apeland' => 'oscar@tiseit.com' } | ||
s.source = { :git => 'https://github.com/tiseoslo/SwipeableViewController.git', :tag => s.version.to_s } | ||
|
||
s.ios.deployment_target = '10.0' | ||
s.source_files = 'SwipeableViewController/Source/*.swift' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...roller.xcodeproj/xcuserdata/oscarapeland.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
type = "1" | ||
version = "2.0"> | ||
<Breakpoints> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "Yes" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "Yes" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
scope = "0" | ||
stopOnStyle = "0"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
</Breakpoints> | ||
</Bucket> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
SwipingViewController/ExampleSwipeableViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// ExampleSwipeableViewController.swift | ||
// SwipingViewController | ||
// | ||
// Created by Oscar Apeland on 13.10.2017. | ||
// Copyright © 2017 Tise. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ExampleSwipeableViewController: SwipeableViewController { | ||
lazy var searchController = UISearchController(searchResultsController: { | ||
$0.view.backgroundColor = .red | ||
return $0 | ||
}(UIViewController())) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
if #available(iOS 11.0, *) { | ||
navigationItem.searchController = searchController | ||
} else { | ||
navigationItem.titleView = searchController.searchBar | ||
} | ||
definesPresentationContext = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// ExampleViewController.swift | ||
// SwipingViewController | ||
// | ||
// Created by Oscar Apeland on 12.10.2017. | ||
// Copyright © 2017 Tise. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ExampleViewController: UIViewController { | ||
lazy var collectionView: UICollectionView = { | ||
$0.backgroundColor = .white | ||
$0.alwaysBounceVertical = true | ||
$0.delegate = self | ||
$0.dataSource = self | ||
$0.autoresizingMask = [.flexibleHeight, .flexibleWidth] | ||
($0.collectionViewLayout as? UICollectionViewFlowLayout)?.sectionInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0) | ||
|
||
return $0 | ||
}(UICollectionView(frame: view.bounds, collectionViewLayout: UICollectionViewFlowLayout())) | ||
|
||
let cellColor = UIColor.random | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.addSubview(collectionView) | ||
if #available(iOS 11.0, *) { | ||
collectionView.contentInsetAdjustmentBehavior = .always | ||
} | ||
} | ||
} | ||
|
||
extension ExampleViewController: UICollectionViewDataSource, UICollectionViewDelegate { | ||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
return 100 | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell") | ||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) | ||
cell.backgroundColor = cellColor | ||
|
||
return cell | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | ||
let vc = UICollectionViewController(collectionViewLayout: UICollectionViewFlowLayout()) | ||
|
||
vc.collectionView?.backgroundColor = .white | ||
vc.collectionView?.dataSource = self | ||
vc.collectionView?.delegate = self | ||
|
||
navigationController?.pushViewController(vc, animated: true) | ||
} | ||
} | ||
|
||
extension UIColor { | ||
class var random: UIColor { | ||
func random() -> CGFloat { | ||
return CGFloat(arc4random()) / CGFloat(UInt32.max) | ||
} | ||
|
||
return UIColor(red: random(), green: random(), blue: random(), alpha: 1.0) | ||
} | ||
} |
Oops, something went wrong.