Skip to content

Instantly share code, notes, and snippets.

@ozgur
Last active August 8, 2017 14:46
Show Gist options
  • Save ozgur/4d42b4ca0d17caa2f3d2a770e478e2a9 to your computer and use it in GitHub Desktop.
Save ozgur/4d42b4ca0d17caa2f3d2a770e478e2a9 to your computer and use it in GitHub Desktop.
Swift protocols returning Self
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