Created
January 20, 2016 22:21
-
-
Save AquaGeek/07ccd5ecc1c93b940f6c to your computer and use it in GitHub Desktop.
Swift Snippets
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
// FROM: http://ankit.im/swift/2016/01/18/first-pure-swift-ios-app-swiflytics/ | |
protocol StoryboardInstantiable { | |
typealias ViewController | |
static var storyboardID: String { get } | |
static func instance(storyboard: UIStoryboard) -> ViewController? | |
} | |
extension StoryboardInstantiable { | |
static func instance(storyboard: UIStoryboard) -> ViewController? { | |
return storyboard.instantiateViewControllerWithIdentifier(Self.storyboardID) as? ViewController | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment