Search code examples
iosmultithreadingswift3nsthread

How to check current thread in Swift 3?


How do I check which one is the current thread in Swift 3?

In previous versions of Swift it was possible to check if the current thread was the main one by doing this:

NSThread.isMainThread()

Solution

  • Looks like it's simply Thread.isMainThread in Swift 3.