Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Helper root view controller class to enforce storyboard initialization without segues and handling dependency.
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