Last active
November 10, 2020 12:14
-
-
Save lahariganti/56db9b6d7063e80736d8b8b4049ba1e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol Storyboarded { | |
static func instantiate() -> Self | |
} | |
extension Storyboarded where Self: UIViewController { | |
static func instantiate() -> Self { | |
let id = String(describing: self) | |
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main) | |
return storyboard.instantiateViewController(identifier: id) as! Self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment