-1

I want to use below code in objective c.

var recordingQueue = DispatchQueue(label: "recordingQueue", qos: DispatchQoS.userInteractive)
Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
iEhsan
  • 47
  • 1
  • 10
  • See [Concurrency Programming Guide: Dispatch Queues](https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ref/doc/uid/TP40008091-CH102-SW1) and [Grand Central Dispatch reference](https://developer.apple.com/documentation/dispatch?language=objc). – Rob Mar 03 '18 at 16:14
  • 1
    Unfortunately, the accepted answer to [the proposed duplicate](https://stackoverflow.com/questions/17690740/create-a-high-priority-serial-dispatch-queue-with-gcd) is out of date. The correct solution is to use QoS as shown in the [alternate answer to that question](https://stackoverflow.com/a/48616812/1271826) or in Enrique's answer below. How to specify QoS is described in WWDC 2014 video [Power, Performance and Diagnostics: What's new in GCD and XPC](https://developer.apple.com/videos/play/wwdc2014/716/). – Rob Mar 03 '18 at 16:56

1 Answers1

12

This is the way you do that in Objective-C:

dispatch_queue_attr_t qos = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, -1);
dispatch_queue_t recordingQueue = dispatch_queue_create("recordingQueue", qos);
Enrique Bermúdez
  • 1,740
  • 2
  • 11
  • 25