class_getMethodImplementation(_:_:)
Returns the function pointer that would be called if a particular message were sent to an instance of a class.
Declaration
func class_getMethodImplementation(_ cls: AnyClass?, _ name: Selector) -> IMP?Parameters
- cls:
The class you want to inspect.
- name:
A selector.
Return Value
The function pointer that would be called if [object name] were called with an instance of the class, or NULL if cls is Nil.
Discussion
class_getMethodImplementation(_:_:) may be faster than method_getImplementation(class_getInstanceMethod(cls, name)).
The function pointer returned may be a function internal to the runtime instead of an actual method implementation. For example, if instances of the class do not respond to the selector, the function pointer returned will be part of the runtime’s message forwarding machinery.
See Also
Working with Classes
class_getName(_:)class_getSuperclass(_:)class_setSuperclass(_:_:)class_isMetaClass(_:)class_getInstanceSize(_:)class_getInstanceVariable(_:_:)class_getClassVariable(_:_:)class_addIvar(_:_:_:_:_:)class_copyIvarList(_:_:)class_getIvarLayout(_:)class_setIvarLayout(_:_:)class_getWeakIvarLayout(_:)class_setWeakIvarLayout(_:_:)class_getProperty(_:_:)class_copyPropertyList(_:_:)