Skip to content

Commit c2160da

Browse files
committed
Implements UIView+Helpers
1 parent 8079d59 commit c2160da

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Foundation
2+
import UIKit
3+
4+
5+
/// UIView Helper Methods
6+
///
7+
extension UIView {
8+
9+
/// Returns the first Object contained within the nib with a name whose name matches with the receiver's type.
10+
/// Note: On error this method is expected to break, by design!
11+
///
12+
class func loadFromNib<T>() -> T {
13+
let nib = UINib(nibName: classNameWithoutNamespaces, bundle: nil)
14+
return nib.instantiate(withOwner: nil, options: nil).first as! T
15+
}
16+
}

0 commit comments

Comments
 (0)