Tue, 4 Oct 2022 00:48:00 +0900

Get the label of current DispatchQueue

1
2
3
4
5
6





import Foundation
public extension DispatchQueue {
  class var currentLabel: String {
      return String(validatingUTF8: __dispatch_queue_get_label(nil)) ?? ""
  }
}

and

1
2





import Foundation
print(DispatchQueue.currentLabel)