---
title: "instanceMethod(for:)"
framework: objectivec
role: symbol
role_heading: Type Method
path: "objectivec/nsobject-swift.class/instancemethod(for:)"
---

# instanceMethod(for:)

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

## Declaration

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

## Parameters

- `aSelector`: A https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/Selector.html#//apple_ref/doc/uid/TP40008195-CH48 that identifies the method for which to return the implementation address. The selector must be non-NULL and valid for the receiver. If in doubt, use the doc://com.apple.objectivec/documentation/ObjectiveC/NSObjectProtocol/responds(to:) method to check before passing the selector to doc://com.apple.objectivec/documentation/ObjectiveC/NSObject-swift.class/method(for:).

## Return Value

Return Value The address of the implementation of the aSelector instance method.

## Discussion

Discussion An error is generated if instances of the receiver can’t respond to aSelector messages. Use this method to ask the class object for the implementation of instance methods only. To ask the class for the implementation of a class method, send the method(for:) instance method to the class instead.

## See Also

### Obtaining Information About Methods

- [method(for:)](objectivec/nsobject-swift.class/method(for:).md)
