Instance Method


Locates and returns the address of the receiver’s implementation of a method so it can be called as a function.


func method(for aSelector: Selector!) -> IMP!



A Selector that identifies the method for which to return the implementation address. The selector must be a valid and non-NULL. If in doubt, use the responds(to:) method to check before passing the selector to method(for:).

Return Value

The address of the receiver’s implementation of the aSelector.


If the receiver is an instance, aSelector should refer to an instance method; if the receiver is a class, it should refer to a class method.

See Also

Obtaining Information About Methods

class func instanceMethod(for: Selector!) -> IMP!

Locates and returns the address of the implementation of the instance method identified by a given selector.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software