Skip to content

Commit 9ec3339

Browse files
committed
UIView+Helpers: New API's
1 parent 2ec2444 commit 9ec3339

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

WooCommerce/Classes/Extensions/UIView+Helpers.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ import UIKit
66
///
77
extension UIView {
88

9+
/// Returns the Nib associated with the received: It's filename is expected to match the Class Name
10+
///
11+
class func loadNib() -> UINib {
12+
return UINib(nibName: classNameWithoutNamespaces, bundle: nil)
13+
}
14+
915
/// Returns the first Object contained within the nib with a name whose name matches with the receiver's type.
1016
/// Note: On error this method is expected to break, by design!
1117
///
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
18+
class func instantiateFromNib<T>() -> T {
19+
return loadNib().instantiate(withOwner: nil, options: nil).first as! T
1520
}
1621
}

0 commit comments

Comments
 (0)