I am trying to convert some swift function to objective-c
extension UIView {
class func fromNib<T: UIView>() -> T {
return Bundle(for: T.self).loadNibNamed(String(describing: T.self), owner: nil, options: nil)![0] as! T
}
}
It is a code from Load a UIView from nib in Swift
I thought .h
file can be wrote like this
@interface UIView <T: UIView *> (MyCommon)
+ (T) loadFromNib;
@end
And I got error like this
Category of non-parameterized class 'UIView' cannot have type parameters
Is that means it's impossible to implement UIView extension function using Generic in objective C?