Created
November 29, 2016 14:49
-
-
Save MylesCaley/b42d7ac04d63a9f998ee0290cfd7147a to your computer and use it in GitHub Desktop.
Load a view from an XIB
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
extension UIView { | |
class func loadFromNibNamed(nibNamed: String, bundle : Bundle? = nil) -> UIView? { | |
return UINib( | |
nibName: nibNamed, | |
bundle: bundle | |
).instantiate(withOwner: nil, options: nil)[0] as? UIView | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment