探秘Runtime
该文章属于<简书 — 刘小壮>原创,转载请注明: <简书 — 刘小壮> https://www.jianshu.com/p/5b7e7c8075ef NSObject 之前的定义 在 OC1.0 中, Runtime 很多定义都写在 NSObject.h 文件中,如果之前研究过 Runtime 的同学可以应该见过下面的定义,定义了一些基础的信息。 // 声明Class和id typedef struct objc_class *Class; typedef struct objc_object *id; // 声明常用变量 typedef struct objc_method *Method; typedef struct objc_ivar *Ivar; typedef struct objc_category *Category; typedef struct objc_property *objc_property_t; // objc_object和objc_class struct objc_object { Class _Nonnull isa OBJC_ISA_AVAILABILITY; }; struct objc_class { Class isa OBJC_ISA_AVAILABILITY; #if !__OBJC2__ Class super_class