What is the isa pointer?
Essence
isa is the first field of every Objective-C object: a reference to its class. Through it objc_msgSend finds the method table and cache, and the runtime finds the lists of ivars, properties and protocols. A class also has an isa — it points to the metaclass, which holds the class methods (+). Metaclasses close the loop on the metaclass of the root class NSObject.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
static void inspect(void) {
NSObject *obj = [NSObject new];
Class cls = object_getClass(obj); // NSObject
Class meta = object_getClass(cls); // metaclass of NSObject
BOOL isMeta = class_isMetaClass(meta); // YES
NSLog(@"%@ %@ %d", cls, meta, isMeta);
}
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep