CJNibSegue 0.2.0

CJNibSegue 0.2.0

LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jan 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Chijioke Ndubisi.

  • By
  • Chijioke Ndubisi



  • Xcode 8
  • Swift 3


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

pod "CJNibSegue"


Create Identifiers

Create an Enum that conforms to CJNibSegueIdentifiable - a protocol composed of RawRepresentable, Hashable

// Step 1 
// Making the enum a string makes the it conform to RawRepresentable and Hashable
enum ChatSegueIdentifiers: String, CJNibSegueIdentifiable {
    case chat
    case call


A source view controller must

  • Conform to CJNibViewController and implement
  • The computed property nibSegue: [NibSegue]? to return all possible segues from this source view controller
// Comform to CJNibViewController
extension SourceViewController: CJNibViewController {
    var nibSegue: [NibSegue]? {
        return [
                    let destination = ChatViewController()
                    return CJNibSegue(identifier: ChatSegueIdentifiers.chat,
                         source: self,
                         destination: destination)
                  }()// call function immediately to return a NibSegue

    func prepare(for nibSegue: NibSegue, sender: Any?) {
        if let segue = nibSegue as? CJNibSegue<SegueIdenifiers, FirstViewController, SecondViewController> 
            switch segue.nibIdentiifer {
            case .chat:
                // set up detination


Trigger Segue

Call performSegue(withIdentifier: .chat,sender: cell)


All are well come via github issues


Chijioke Ndubisi, [email protected]


CJNibSegue is available under the MIT license. See the LICENSE file for more info.