Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. ```swift
  2. func testConcurrentAsyncOperation() {
  3. let exp = expectation(description: "\(#function)\(#line)")
  4.  
  5. // Create the main operation
  6. let main = ConcurrentAsyncOperation()
  7. // The main completion block is executed after the operation has completed.
  8. main.completionBlock = {
  9. // Check if the data is received from the dependent operation
  10. print("The completion block is called.")
  11. main.completionBlock = nil
  12. exp.fulfill()
  13. }
  14.  
  15. main.start()
  16.  
  17. waitForExpectations(timeout: 40, handler: nil)
  18. }
  19. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement