NSOperation and NSOperationQueue Tutorial in Swift

here is the code updated to Swift 3. GitHub - josman185/ClassicPhotos: NSOperation and NSOperationQueue Tutorial in Swift

Wonderful Tutorial , many thanks

HI

In the function
fetchPhotoDetails() {

We are using the following code to access the main queue
NSURLConnection.sendAsynchronousRequest(request as URLRequest, queue: OperationQueue.main) {response,data,error in

      ...............................................

but it seems to be depreciated in the current Release of Swift and giving warning

‘sendAsynchronousRequest(_:queue:completionHandler:)’ was deprecated in iOS 9.0: Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h

and when i try to implement using the following way

//let task = URLSession.shared.dataTask(with: request as URLRequest ){ data, response, error in

There is no way to specify queue ?

Can you please suggest how can we implement this ? or am i missing something

Many thanks

@jrturton Sir, very informative tutorial! ,you are storing ‘image’ object in the ‘PhotoRecord’ class object as follows:
class PhotoRecord {
let name:String
let url:NSURL
var state = PhotoRecordState.New
var image = UIImage(named: “Placeholder”)
}

For large number of table View cells, is it advisable to store the image object? Will it not consume a lot of memory ?

OMG this tutorial is amazing. Kudos

So nobody noticed that

let downloader = ImageDownloader(photoRecord: photoDetails)
//3
downloader.completionBlock = {
if downloader.cancelled {
return
}
dispatch_async(dispatch_get_main_queue(), {
self.pendingOperations.downloadsInProgress.removeValueForKey(indexPath)
self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
})
}

leads to retain cycle? I am pretty sure that’s it so.

This tutorial is more than six months old, so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]