Skip to content

Instantly share code, notes, and snippets.

@AquaGeek
Created January 20, 2016 22:21
Show Gist options
  • Save AquaGeek/07ccd5ecc1c93b940f6c to your computer and use it in GitHub Desktop.
Save AquaGeek/07ccd5ecc1c93b940f6c to your computer and use it in GitHub Desktop.
Swift Snippets
// 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