Class
1 typedef struct objc_class *Class;
1 struct objc_class { 2 Class isa OBJC_ISA_AVAILABILITY; 3 4 #if !__OBJC2__ 5 Class super_class OBJC2_UNAVAILABLE; 6 const char *name OBJC2_UNAVAILABLE; 7 long version OBJC2_UNAVAILABLE; 8 long info OBJC2_UNAVAILABLE; 9 long instance_size OBJC2_UNAVAILABLE; 10 struct objc_ivar_list *ivars OBJC2_UNAVAILABLE; 11 struct objc_method_list **methodLists OBJC2_UNAVAILABLE; 12 struct objc_cache *cache OBJC2_UNAVAILABLE; 13 struct objc_protocol_list *protocols OBJC2_UNAVAILABLE; 14 #endif 15 16 } OBJC2_UNAVAILABLE;
Method
1 typedef struct objc_method *Method; 2 3 typedef struct objc_ method { 4 5 SEL method_name; 6 7 char *method_types; 8 9 IMP method_imp; 10 11 };
SEl
1 const char *sel_getName(SEL sel) { 2 #ifndef NO_GC 3 if ((uintptr_t)sel == kIgnore) return "<ignored selector>"; 4 #endif 5 return sel ? (const char *)sel : "<null selector>"; 6 }
http://opensource.apple.com/source/objc4/objc4-437/runtime/objc-sel.mm
从这里我们可以看除SEL,实际上就是字符串
IMP
1 typedef id (*IMP)(id, SEL, ...)
可以看出IMP就是一个函数指针,它指向的函数返回值为id,包含id类型(消息接收对象),SEL类型(方法名)和可变参数(方法参数)