Skip to content

Instantly share code, notes, and snippets.

@aryaxt
Created November 28, 2015 21:52
Show Gist options
  • Save aryaxt/d7565f4be62af30acb5c to your computer and use it in GitHub Desktop.
Save aryaxt/d7565f4be62af30acb5c to your computer and use it in GitHub Desktop.
UIView+Extension
public extension UIView {
public class func initializeFromNib() -> Self {
return initializeFromNib(self)
}
public class func initializeFromNib<T: UIView>(type: T.Type) -> T {
return NSBundle.mainBundle().loadNibNamed(String(type), owner: nil, options: nil).first as! T
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment