Last active
August 8, 2017 14:46
-
-
Save ozgur/4d42b4ca0d17caa2f3d2a770e478e2a9 to your computer and use it in GitHub Desktop.
Swift protocols returning Self
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
public protocol NIBLoadable { | |
static func fromNib() -> Self | |
} | |
extension UIViewController: NIBLoadable { | |
public static func fromNib() -> Self { | |
return self.init(nibName: NSStringFromClass(self), bundle: Bundle(for: self)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment