Skip to content

Instantly share code, notes, and snippets.

Last active September 7, 2016 17:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
ViewController Dependency Injection
public class ExampleViewController: UIViewController {
var dependableService: DependableService
@IBOutlet var someTextLabel: UITextLabel!
class func loadFromStoryboard(
dependableService: DependableService) -> ExampleViewController {
let controller = UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
as! ExampleViewController
controller.dependableService = dependableService
return controller
required public init?(coder aDecoder: NSCoder) {
self.dependableService = AppEnvironment.sharedEnvironment.dependableService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment