Skip to content

Instantly share code, notes, and snippets.

@MylesCaley
Created November 29, 2016 14:49
Show Gist options
  • Save MylesCaley/b42d7ac04d63a9f998ee0290cfd7147a to your computer and use it in GitHub Desktop.
Save MylesCaley/b42d7ac04d63a9f998ee0290cfd7147a to your computer and use it in GitHub Desktop.
Load a view from an XIB
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