---
title: "performSelector(inBackground:with:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/performselector(inbackground:with:)"
---

# performSelector(inBackground:with:)

Invokes a method of the receiver on a new background thread.

## Declaration

```swift
func performSelector(inBackground aSelector: Selector, with arg: Any?)
```

## 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 to invoke. The method should not have a significant return value and should take a single argument of type id, or no arguments.
- `arg`: The argument to pass to the method when it is invoked. Pass nil if the method does not take an argument.

## Discussion

Discussion This method creates a new thread in your application, putting your application into multithreaded mode if it was not already. The method represented by aSelector must set up the thread environment just as you would for any other new thread in your program. For more information about how to configure and run threads, see Threading Programming Guide.

## See Also

### Sending Messages

- [perform(_:with:afterDelay:)](objectivec/nsobject-swift.class/perform(_:with:afterdelay:).md)
- [perform(_:with:afterDelay:inModes:)](objectivec/nsobject-swift.class/perform(_:with:afterdelay:inmodes:).md)
- [performSelector(onMainThread:with:waitUntilDone:)](objectivec/nsobject-swift.class/performselector(onmainthread:with:waituntildone:).md)
- [performSelector(onMainThread:with:waitUntilDone:modes:)](objectivec/nsobject-swift.class/performselector(onmainthread:with:waituntildone:modes:).md)
- [perform(_:on:with:waitUntilDone:)](objectivec/nsobject-swift.class/perform(_:on:with:waituntildone:).md)
- [perform(_:on:with:waitUntilDone:modes:)](objectivec/nsobject-swift.class/perform(_:on:with:waituntildone:modes:).md)
- [cancelPreviousPerformRequests(withTarget:)](objectivec/nsobject-swift.class/cancelpreviousperformrequests(withtarget:).md)
- [cancelPreviousPerformRequests(withTarget:selector:object:)](objectivec/nsobject-swift.class/cancelpreviousperformrequests(withtarget:selector:object:).md)
