Created
January 26, 2017 00:49
-
-
Save chelseatroy/3775bef9f0f2a8e0862a3431e6a04e3f to your computer and use it in GitHub Desktop.
Load from Storyboard iOS Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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