The main entry point routine for the thread.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func main()
Discussion
The default implementation of this method takes the target and selector used to initialize the receiver and invokes the selector on the specified target. If you subclass NSThread
, you can override this method and use it to implement the main body of your thread instead. If you do so, you do not need to invoke super
.
You should never invoke this method directly. You should always start your thread by invoking the start()
method.