<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Thread/detachNewThreadSelector(_:toTarget:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSThread(cm)detachNewThreadSelector:toTarget:withObject:"
  },
  "title" : "detachNewThreadSelector(_:toTarget:with:)"
}
-->

# detachNewThreadSelector(_:toTarget:with:)

Detaches a new thread and uses the specified selector as the thread entry point.

```
class func detachNewThreadSelector(_ selector: Selector, toTarget target: Any, with argument: Any?)
```

## Parameters

`selector`

The selector for the message to send to the target. This selector must take only one argument and must not have a return value.

`target`

The object that will receive the message `aSelector` on the new thread.

`argument`

The single argument passed to the target. May be `nil`.

## Discussion

The objects `aTarget` and `anArgument` are retained during the execution of the detached thread, then released. The detached thread is exited (using the [`exit()`](/documentation/Foundation/Thread/exit()) class method) as soon as `aTarget` has completed executing the `aSelector` method.

If this thread is the first thread detached in the application, this method posts the [`NSWillBecomeMultiThreaded`](/documentation/Foundation/NSNotification/Name-swift.struct/NSWillBecomeMultiThreaded) with object `nil` to the default notification center.

## See Also

[`isMultiThreaded()`](/documentation/Foundation/Thread/isMultiThreaded())

Returns whether the application is multithreaded.

[`current`](/documentation/Foundation/Thread/current)

Returns the thread object representing the current thread of execution.



---

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)