Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created July 29, 2017 20:01
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 efremidze/07e01e58825fe65741f090c8ac5f886f to your computer and use it in GitHub Desktop.
Save efremidze/07e01e58825fe65741f090c8ac5f886f to your computer and use it in GitHub Desktop.
protocol XibViewProtocol {}
extension XibViewProtocol where Self: UIView {
static func nib(_ name: String? = nil, owner: Any? = nil, bundle: Bundle = .framework) -> Self {
return bundle.loadNibNamed(name ?? String(describing: self), owner: owner, options: nil)!.first as! Self
}
}
extension UIView: XibViewProtocol {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment