How to check current thread in Swift 3?

BalestraPatrick picture BalestraPatrick · Sep 3, 2016 · Viewed 45.3k times · Source

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()

Answer

BalestraPatrick picture BalestraPatrick · Sep 3, 2016

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