1. Objc_xxx series of functions

The objC_ family of functions focuses on macro usage, such as class and protocol space allocation, registration, logout, and other operations

  • objc_getClassGet the Class object
  • objc_getMetaClassGet the MetaClass object
  • objc_allocateClassPairAllocate space, create classes (member variables can be added only after creation, but before registration)
  • objc_registerClassPairRegister a class (you can use that class to create objects)
  • objc_disposeClassPairUnregister a class
  • objc_allocateProtocolOpen up space to create protocols
  • objc_registerProtocolRegister a protocol
  • objc_constructInstanceConstruct an instance object (invalid under ARC)
  • objc_destructInstanceDestruct an instance object (invalid under ARC)
  • objc_setAssociatedObjectAssociate an object with an instance object
  • objc_getAssociatedObje*ctGets the associated object of the instance object
  • objc_removeAssociatedObjectsClears all associated objects of the instance object

2. Class_xxx series functions

The class_ family of functions focuses on the internals of a class, such as instance variables, attributes, methods, protocols, etc

  • class_addIvarAdd instance variables for the class
  • class_addPropertyAdd attributes to the class
  • class_addMethodAdd methods for classes
  • class_addProtocolFollow the protocol for the class
  • class_replaceMethodReplace the implementation of a method of a class
  • class_getNameGet the name of the class
  • class_isMetaClassDetermine whether it is a metaclass
  • objc_getProtocolGet a protocol
  • objc_copyProtocolListCopy the list of protocols registered at run time
  • class_getSuperclassGets the parent of a class
  • class_setSuperclassSets the parent of a class
  • class_getPropertyGets a property of a class
  • class_getInstanceVariableGet instance variables
  • class_getClassVariableGet class variables
  • class_getInstanceMethodGet instance method
  • class_getClassMethodGet class methods
  • class_getMethodImplementationGet the implementation of the method
  • class_getInstanceSizeGets the size of an instance of the class
  • class_respondsToSelectorDetermines whether a class implements a method
  • class_conformsToProtocolDetermines whether a class complies with a protocol
  • class_createInstanceCreate an instance of the class
  • class_copyIvarListCopy the list of instance variables of the class
  • class_copyMethodListCopy the list of methods for the class
  • class_copyProtocolListCopy the list of protocols that the class follows
  • class_copyPropertyListCopy the property list of the class

3.object_xxx series of functions

The objcet_ family of functions focuses on object perspectives, such as instance variables

  • object_copyObject copy(ARC invalid)
  • object_disposeObject release (ARC invalid)
  • object_getClassNameGets the class name of the object
  • object_getClassGets the Class of the object
  • object_setClassSets the Class of the object
  • object_getIvarGets the value of an instance variable in an object
  • object_setIvarSets the value of the instance variable in the object
  • object_getInstanceVariableGet the value of the instance variable in the object (not valid in ARC, using object_getIvar)
  • object_setInstanceVariableSet the value of an instance variable in an object (not valid in ARC, using object_setIvar)

4. Method_xxx series of functions

The method_ family of functions focuses on the inside of a method, the parameters and return value types of the method, and the implementation of the method

  • method_getNameGet method name
  • method_getImplementationGet the implementation of the method
  • method_getTypeEncodingGets the type encoding of the method
  • method_getNumberOfArgumentsGets the number of arguments to the method
  • method_copyReturnTypeThe return type of the copy method
  • method_getReturnTypeGets the return type of the method
  • method_copyArgumentTypeThe parameter type of the copy method
  • method_getArgumentTypeGets the parameter type of the method
  • method_getDescriptionGets a description of the method
  • method_setImplementationThe implementation of the set method
  • method_exchangeImplementationsImplementation of replacement methods

5. Property_xxx series functions

Property_ class functions look inside properties, such as properties of properties

  • property_getNameGet attribute name
  • property_getAttributesGets the property list for the property
  • property_copyAttributeListProperty list of copy properties
  • property_copyAttributeValueCopies the value of a property in the property

6. Protocol_xxx series functions

  • protocol_conformsToProtocolDetermine whether one protocol complies with another
  • protocol_isEqualDetermine whether the two protocols are consistent
  • protocol_getNameObtaining the protocol name
  • protocol_copyPropertyListCopy the protocol property list
  • protocol_copyProtocolListCopy the protocol list followed by a protocol
  • protocol_copyMethodDescriptionListList of methods to copy the protocol
  • protocol_addProtocolFollow one protocol for another
  • protocol_addPropertyAdd attributes for the protocol
  • protocol_getPropertyGets an attribute in the protocol
  • protocol_addMethodDescriptionAdd a method description for the protocol
  • protocol_getMethodDescriptionGets the description of a method in the protocol

Ivar_xxx series of functions

  • ivar_getNameObtain the Ivar name
  • ivar_getTypeEncodingGet type encoding
  • ivar_getOffsetGet offset

Sel_xxx series of functions

  • sel_getNameGet the name
  • sel_getUidRegistration method
  • sel_registerNameRegistration method
  • sel_isEqualDetermine whether the methods are equal

9. Imp_xxx series functions

  • imp_implementationWithBlockCreate imPs from blocks of code
  • imp_getBlockGets a block of code in a function pointer
  • imp_removeBlockRemove code blocks in IMP