Latest 2.0.1
License MIT
Platforms ios 8.3, requires ARC

Build Status
Carthage compatible



ContainerViewSegueManager is responsible for telling your UIViewController which segue it should perform.

Creating your containerView

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.

Subclassing ContainerDataManager

You should create a subclass of ContainerDataManager and override the additionalSetup method:


import UIKit
import ContainerManager

class MyContainerData: ContainerDataManager

Choosing which segueIdentifier will be used

ContainerDataManager 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"

Swapping viewController

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.

Installation with CocoaPods

ContainerManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:

source ''
platform :ios, '8.3'

pod 'ContainerManager', '~> 2.0.0'

Then, run the following command:

$ pod install

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ContainerManager into your Xcode project using Carthage, specify it in your Cartfile:

github "brurend/ContainerManager" ~> 2.0.0

Run carthage to build the framework and drag the built ContainerManager.framework into your Xcode project.


Bruno Rendeiro, [email protected]


ContainerManager is available under the MIT license. See the License file for more info.

Latest podspec

    "name": "ContainerManager",
    "version": "2.0.1",
    "summary": "Helper classes to ContainerView usage with IE in Swift.",
    "description": "ContainerManager helps you with linking more than one ViewController to the same ContainerView with segues in the Interface Builder in Swift.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "brurend": "[email protected]"
    "source": {
        "git": "",
        "tag": "2.0.1"
    "platforms": {
        "ios": "8.3"
    "requires_arc": true,
    "source_files": "ContainerManager/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This