Created
May 10, 2019 23:49
-
-
Save shabib87/c311d48c206cb013c42ea7d17ef9d189 to your computer and use it in GitHub Desktop.
Helper root view controller class to enforce storyboard initialization without segues and handling dependency.
This file contains 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
class RootViewController: UIViewController, StoryboardInitializable { | |
class func instantiateFromStoryboard(presenter aPresenter: Presenter) -> UIViewController { | |
fatalError("Override failed. Dependency injection not processed. Presenter injection hampered.") | |
} | |
// Preventing segue to support dependency injection | |
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool { | |
fatalError("Segues should not be used. Presenter injection hampered.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment