---
title: "method(for:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/method(for:)"
---

# method(for:)

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

## Declaration

```swift
func method(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 a valid and non-NULL. 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 receiver’s implementation of the aSelector.

## Discussion

Discussion 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

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