---
title: "perform(_:with:with:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobjectprotocol/perform(_:with:with:)"
---

# perform(_:with:with:)

Sends a message to the receiver with two objects as arguments.

## Declaration

```swift
func perform(_ aSelector: Selector!, with object1: Any!, with object2: Any!) -> Unmanaged<AnyObject>!
```

## Parameters

- `aSelector`: A selector identifying the message to send. If aSelector is NULL, an doc://com.apple.documentation/documentation/Foundation/NSExceptionName/invalidArgumentException is raised.
- `object1`: An object that is the first argument of the message.
- `object2`: An object that is the second argument of the message

## Return Value

Return Value An object that is the result of the message.

## Discussion

Discussion This method is the same as perform(_:) except that you can supply two arguments for aSelector. aSelector should identify a method that can take two arguments of type id. For methods with other argument types and return values, use NSInvocation.

## See Also

### Related Documentation

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

### Sending Messages

- [perform(_:)](objectivec/nsobjectprotocol/perform(_:).md)
- [perform(_:with:)](objectivec/nsobjectprotocol/perform(_:with:).md)
