Created
October 25, 2016 07:53
-
-
Save jeden/233dfc30f4688adce817b78009719475 to your computer and use it in GitHub Desktop.
Method to load a view from its nib
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
// 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