Created
March 4, 2020 17:09
-
-
Save rahul-inspired-iosdeveloper/e47d4eb66b0548c6cff8413cc7fc6e1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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