Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created January 26, 2017 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/3775bef9f0f2a8e0862a3431e6a04e3f to your computer and use it in GitHub Desktop.
Save chelseatroy/3775bef9f0f2a8e0862a3431e6a04e3f to your computer and use it in GitHub Desktop.
Load from Storyboard iOS Example
import UIKit
class ExampleViewController: UIViewController {
class func loadFromStoryboard(exampleService: ExampleService) -> ExampleViewController {
let exampleViewController:ExampleViewController =
UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
.instantiateViewControllerWithIdentifier("ExampleViewController")
as! ExampleViewController
exampleViewController.exampleService = exampleService
return exampleViewController
}
required init?(coder aDecoder: NSCoder) {
self.exampleService = AppEnvironment.sharedEnvironment.exampleService
super.init(coder:aDecoder)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment