Created
April 21, 2018 16:27
-
-
Save rayfix/3fff9695247aa1b9b6979557c5463de0 to your computer and use it in GitHub Desktop.
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
extension StoryboardInitializable where Self: UIViewController { | |
static var storyboardName: String { | |
return "Main" | |
} | |
static var storyboardBundle: Bundle? { | |
return nil | |
} | |
static var storyboardIdentifier: String { | |
return String(describing: self) | |
} | |
static func makeFromStoryboard() -> Self { | |
let storyboard = UIStoryboard(name: storyboardName, bundle: storyboardBundle) | |
return storyboard.instantiateViewController(withIdentifier: storyboardIdentifier) as! Self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment