Function

class_copyMethodList

Describes the instance methods implemented by a class.

Declaration

Method  _Nonnull * class_copyMethodList(Class cls, unsigned int *outCount);

Parameters

cls

The class you want to inspect.

outCount

On return, contains the length of the returned array. If outCount is NULL, the length is not returned.

Return Value

An array of pointers of type Method describing the instance methods implemented by the class—any instance methods implemented by superclasses are not included. The array contains *outCount pointers followed by a NULL terminator. You must free the array with free().

If cls implements no instance methods, or cls is Nil, returns NULL and *outCount is 0.

Discussion

To get the class methods of a class, use class_copyMethodList(object_getClass(cls), &count).

To get the implementations of methods that may be implemented by superclasses, use class_getInstanceMethod or class_getClassMethod.

See Also

Working with Classes

class_getName

Returns the name of a class.

class_getSuperclass

Returns the superclass of a class.

class_setSuperclass

Sets the superclass of a given class.

Deprecated
class_isMetaClass

Returns a Boolean value that indicates whether a class object is a metaclass.

class_getInstanceSize

Returns the size of instances of a class.

class_getInstanceVariable

Returns the Ivar for a specified instance variable of a given class.

class_getClassVariable

Returns the Ivar for a specified class variable of a given class.

class_addIvar

Adds a new instance variable to a class.

class_copyIvarList

Describes the instance variables declared by a class.

class_getIvarLayout

Returns a description of the Ivar layout for a given class.

class_setIvarLayout

Sets the Ivar layout for a given class.

class_getWeakIvarLayout

Returns a description of the layout of weak Ivars for a given class.

class_setWeakIvarLayout

Sets the layout for weak Ivars for a given class.

class_getProperty

Returns a property with a given name of a given class.

class_copyPropertyList

Describes the properties declared by a class.

class_addMethod

Adds a new method to a class with a given name and implementation.

class_getInstanceMethod

Returns a specified instance method for a given class.

class_getClassMethod

Returns a pointer to the data structure describing a given class method for a given class.

class_replaceMethod

Replaces the implementation of a method for a given class.

class_getMethodImplementation

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

class_getMethodImplementation_stret

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

class_respondsToSelector

Returns a Boolean value that indicates whether instances of a class respond to a particular selector.

class_addProtocol

Adds a protocol to a class.

class_addProperty

Adds a property to a class.

class_replaceProperty

Replace a property of a class.

class_conformsToProtocol

Returns a Boolean value that indicates whether a class conforms to a given protocol.

class_copyProtocolList

Describes the protocols adopted by a class.

class_getVersion

Returns the version number of a class definition.

class_setVersion

Sets the version number of a class definition.

objc_getFutureClass

Used by CoreFoundation's toll-free bridging.

objc_setFutureClass

Used by CoreFoundation's toll-free bridging.