Last active
August 2, 2017 14:06
-
-
Save Daemon-Devarshi/1f8525298cd01f394400198f9747d106 to your computer and use it in GitHub Desktop.
A protocol to be used to avoid hardcoding of reuse identifier (reference link: https://medium.com/swift-programming/uistoryboard-safer-with-enums-protocol-extensions-and-generics-7aad3883b44d)
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
protocol StoryboardIdentifiable { | |
static var storyboardIdentifier: String { get } | |
} | |
extension StoryboardIdentifiable where Self: UIViewController { | |
static var storyboardIdentifier: String { | |
return String(describing: self) | |
} | |
} | |
// Uncomment for Global Confirmance | |
// extension UIViewController: StoryboardIdentifiable { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment