---
title: "cancelPerform(_:target:argument:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/runloop/cancelperform(_:target:argument:)"
---

# cancelPerform(_:target:argument:)

Cancels the sending of a previously scheduled message.

## Declaration

```swift
func cancelPerform(_ aSelector: Selector, target: Any, argument arg: Any?)
```

## Parameters

- `aSelector`: The previously-specified selector.
- `target`: The previously-specified target.
- `arg`: The previously-specified argument.

## Discussion

Discussion You can use this method to cancel a message previously scheduled using the perform(_:target:argument:order:modes:) method. The parameters identify the message you want to cancel and must match those originally specified when the selector was scheduled. This method removes the perform request from all modes of the run loop.

## See Also

### Scheduling and Canceling Tasks

- [perform(_:)](foundation/runloop/perform(_:).md)
- [perform(inModes:block:)](foundation/runloop/perform(inmodes:block:).md)
- [perform(_:target:argument:order:modes:)](foundation/runloop/perform(_:target:argument:order:modes:).md)
- [cancelPerformSelectors(withTarget:)](foundation/runloop/cancelperformselectors(withtarget:).md)
