CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Dec 2016 |
| SwiftSwift Version | 3.0 |
| SPMSupports SPM | ✗ |
Maintained by Bruno Rendeiro.
ContainerViewSegueManager is responsible for telling your UIViewController which segue it should perform.
After dropping your container into your UIViewController you should name its embedSegue identifier:
you also need to make sure the embed UIViewController custom class is ContainerViewSegueManager
and then in your UIViewController class override prepareForSegue:sender: with references to ContainerViewSegueManager and an instance of your ContainerDataManager subclass:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "embedSegue" {
self.containerView = segue.destinationViewController as! ContainerViewSegueManager
let data = MyContainerData(fromParent: self, fromContainer: self.containerView)
self.containerView.containerDataClass = data
}
}Make sure shouldPerformSegueWithIdentifier:sender: returns YES
override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool {
return true
}All segues from your ContainerViewSegueManager to your UIViewController should be of the type EmptySegue and have an identifier, don’t forget to set the “Module” to ContainerManager:
ContainerDataManager is responsible for deciding which segueIdentifier should be passed to performSegueWithIdentifier:sender: of ContainerViewSegueManager based on your application data and needs.
ContainerDataManager You should create a subclass of ContainerDataManager and override the additionalSetup method:
MyContainerDataManager.h
import UIKit
import ContainerManager
class MyContainerData: ContainerDataManagersegueIdentifier will be usedContainerDataManager additionalSetup method will be overridden by your class implementation. self.currentSegueIdentifier must NOT be nil.
override func additionalSetup() {
let array = [1,2,3]
if array.count != 0 {
self.currentSegueIdentifier = "FirstViewController"
}
else {
self.currentSegueIdentifier = "SecondViewController"
}
}You can use ContainerViewSegueManager swapFromViewController:toViewController to go from one UIViewController to another UIViewController easily.
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let second = storyboard.instantiateViewControllerWithIdentifier("SecondViewController")
container.swapFromViewController(self, toViewController: second)ContainerManager supports iOS 8.3+. Updated to Swift 3.0
ContainerManager supports multiple methods for installing the library in a project.
Bruno Rendeiro, [email protected].
ContainerManager is available under the MIT license. See the License file for more info.