How to get the current queue name in swift 3

前端 未结 6 922
遇见更好的自我
遇见更好的自我 2020-12-23 21:52

We have function like this in swift 2.2 for printing a log message with the current running thread:

func MyLog(_ message: String) {
    if Thread.isMainThre         


        
6条回答
  •  感情败类
    2020-12-23 22:40

    This method will work for both OperationQueue and DispatchQueue.

    func printCurrnetQueueName()
    {
        print(Thread.current.name!)
    } 
    

提交回复
热议问题