Skip to content

Instantly share code, notes, and snippets.

@rahul-inspired-iosdeveloper
Created March 4, 2020 17:09
Show Gist options
  • Save rahul-inspired-iosdeveloper/e47d4eb66b0548c6cff8413cc7fc6e1b to your computer and use it in GitHub Desktop.
Save rahul-inspired-iosdeveloper/e47d4eb66b0548c6cff8413cc7fc6e1b to your computer and use it in GitHub Desktop.
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 2
let operation1 = BlockOperation(block: {
let a = 5+1000
print(a)
})
operation1.qualityOfService = .userInitiated
let operation2 = BlockOperation(block: {
let b = 5+2000
print(b)
})
operation1.completionBlock = {
}
operation2.completionBlock = {
}
operation2.addDependency(operation1)
queue.addOperation(operation1)
queue.addOperation(operation2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment