I didn't get the usage of "Class" in Objective-c file. It looks like this developer is mixing c++ and Objective-c (I may be wrong). I learned that we can write C functions in Objective-c code but I am not sure about this Class concept.
Since I am new to Objective-c so it would be great if someone please refer me some tutorial or book where I can learn.
Class (with a capital C) is an Objective-C runtime type representing a class, not an instance of a class.
The documentation doesn't really offer much:
An opaque type that represents an Objective-C class.
typedef struct objc_class *Class;
Declared In
objc.h
Its most common usage is probably checking the class of an instance.
if ( [value isKindOfClass: [NSDictionary class] ) {
// value is a dictionary
}
You could write this as:
Class dictionaryClass = [NSDictionary class];
if ( [value isKindOfClass: dictionaryClass ) {
// value is a dictionary
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With