How to print current thread name in async function

Viewed 58

I tried logging \(Thread.current)] in my async function and got a warning:

Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6

However when I ran a unit test, I still was able to print the value:

[<NSThread: 0x600000e960c0>{number = 2, name = (null)}]

So can I ignore this warning? Or will it produce unexpected results in actual app?

0 Answers
Related