In quick 2 - For storyboard:
let bundle = NSBundle(identifier:"com.bundileName.Name") let storyboard = UIStoryboard(name:"Storyboard", bundle:bundle!) let controller = storyboard.instantiateViewControllerWithIdentifier("ViewControllerId") as UIViewController presentViewController(controller, animated: true, completion: nil)
For XIB:
let bundle = NSBundle(identifier:"com.bundileName.Name") if !(bundle == nil){ let objtestViewController = testViewController(nibName: "testViewController", bundle: bundle) presentViewController(objtestViewController, animated: true, completion: nil) }
Swift 3 Storyboard:
let bundle = Bundle(identifier:"com.bundileName.Name") let storyboard = UIStoryboard(name:"Storyboard", bundle:bundle!) let controller = storyboard.instantiateViewController(withIdentifier: "ViewControllerId") as UIViewController present(controller, animated: true, completion: nil)
XIb
let bundle = NSBundle(identifier:"com.bundileName.Name") if !(bundle == nil){ let objtestViewController = testViewController(nibName: "testViewController", bundle: bundle) present(objtestViewController, animated: true, completion: nil) }
Here the package name is the framework package identifier.
source share