Skip to content

Instantly share code, notes, and snippets.

@jeden
Created October 25, 2016 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeden/233dfc30f4688adce817b78009719475 to your computer and use it in GitHub Desktop.
Save jeden/233dfc30f4688adce817b78009719475 to your computer and use it in GitHub Desktop.
Method to load a view from its nib
// Note: this should be converted into an extension of a new protocol,
// such that the return type is the actual type and not a static `UIView`
extension UIView {
static func nibInstance() -> UIView? {
if let view = Bundle.mainBundle.loadNibNamed(String.className(self), owner: nil, options: nil)?.first as? UIView {
return loginView
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment