Networking with URLSession - Part 10: OperationQueue | Ray Wenderlich

URLSession is an OperationQueue, and delegate and completion methods run on another OperationQueue: learn how to customize the delegate queue.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3986-networking-with-urlsession/lessons/10

Hello @audrey ,

Thank you for guiding us through another great tutorial! Quick question about the challenge:

I received the “Expected declaration [in APIManager]” error next to Line2. Shouldn’t I have to wrap all (or at least, a piece) of the following code in a function to move forward in the challenge?

Line1: let delegateQueue = OperationQueue()
Line2: delegateQueue.name = “sessionDelegateQueue”
Line3: delegateQueue.qualityOfService = .userInitiated
Line4: apiManager.downloadsSession = URLSession(configuration: configuration,
delegate: self, delegateQueue: delegateQueue)

hi! those lines should go into SearchViewController’s viewDidLoad, to replace the second line:

apiManager.downloadsSession = downloadsSession

sorry for the confusion!