<!--
{
  "availability" : [
    "iOS: 1.0.0 -",
    "iPadOS: 1.0.0 -",
    "macCatalyst: 1.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 1.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObjectProtocol/perform(_:with:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(pl)NSObject(im)performSelector:withObject:withObject:"
  },
  "title" : "perform(_:with:with:)"
}
-->

# perform(_:with:with:)

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

```
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

An object that is the result of the message.

## Discussion

This method is the same as [`perform(_:)`](/documentation/ObjectiveC/NSObjectProtocol/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 <doc://com.apple.documentation/documentation/Foundation/NSInvocation>.

## See Also

[`method(for:)`](/documentation/ObjectiveC/NSObject-swift.class/method(for:))

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



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)