So I have this code in a swift project:
self.operationQueue = NSOperationQueue()
self.operationQueue.maxConcurrentOperationCount(NSOperationQueueDefaultMaxConcurrentOperationCount)
This does not work. On the second line I get this error:
(Int) -> $T4 is not identical to 'Int'
How can I set the NSOperationQueueDefaultMaxConcurrentOperationCount on the opertaionQueue in swift?
If you check the header file for for NSOperationQueue
:
var maxConcurrentOperationCount: Int
you'll see that maxConcurrentOperationCount
is a property, not a method, so you'll need to use:
self.operationQueue = NSOperationQueue()
self.operationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount