What is the difference between the isKindOfClass:(Class)aClass
and the isMemberOfClass:(Class)aClass
functions?
I know it is something small like, one is global while the other is an exact class match but I need someone to specify which is which please.
In Swift isKind(of aClass: AnyClass)
and isMember(of aClass: AnyClass)
.
isKindOfClass:
returns YES
if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class.
isMemberOfClass:
returns YES
if, and only if, the receiver is an instance of the specified class.
Most of the time you want to use isKindOfClass:
to ensure that your code also works with subclasses.
The NSObject Protocol Reference talks a little more about these methods.