Function 関数

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 クラスを扱う