Reputation: 2773
I can't conform NSCopying protocol when I try to use the swift 3 way, My code is:
public func copy(with zone: NSZone? = nil) -> Any {
return type(of:self).init(self)
}
But an error appears:
Cannot call value of non-function type 'ProductType'
What is the problem here?
Upvotes: 4
Views: 1643
Reputation: 2773
I just found the solution, change the function for:
public func copy(with zone: NSZone? = nil) -> Any {
return Swift.type(of:self).init(self)
}
Upvotes: 3