Swift 3: Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority'

Solutions Collect From Internet About “Swift 3: Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority'”

WARNING, This is deprecated in iOS 8, see below for latest

DispatchQueue.global expects the DispatchQueue.GlobalQueuePriority enum, which is:

  • high
  • default
  • low
  • background

So in your case, you just write:

DispatchQueue.global(priority: .background).async(execute: { () -> Void in

})

If you want the lowest priority.

A quick check reveals, that DispatchQueue.global(priority:_) is deprecated in iOS 8.

Latest solution:

DispatchQueue.global(qos: .background).async {

}

Which gives you even more options to choose from:

  • background
  • utility
  • default
  • userInitiated
  • userInteractive
  • unspecified