Skip to content

This is a sample code based on Ray Wenderlich tutorial for operation which improved it’s code to a better and more understandable code.

Notifications You must be signed in to change notification settings

ssamadgh/Ray-Wenderlich-Tutorial-and-Advanced-Operation

Repository files navigation

Ray Wenderlich Operation Tutorial and Advanced Operation Sample

Swift 4.0 Platform iOS | macOS ssamadgh Twitter ssamadgh Linkedin

Advanced Operation Sample in Swift

This is a sample code about using Advanced operation in swift.

The base sample code is taken from NSOperation and NSOperationQueue Tutorial in Swift - Ray Wenderlich and rewrited by using Advanced operation library of Advanced NSOperations - WWDC 2015 - Session 226.

Demo

The Starter Project

Session

The Ray Wenderlich Version Completed project

Session

The Advanced Operation Version Completed Project

Session

How to use This Sample

For learning

First of all, if you haven't enough expriment about using operations in swift, have a look to raywenderlich tutorial. the starter and completed of raywenderlich tutorial sample codes are exist in this sample codes for comparing with advanced operation version. all sample codes are updated to swift 4 syntax.

Next, compare ClassicPhotos written with Advanced Operation and ClassicPhotos app created by raywenderlich tutorial. look at differences in codes and runing. for more information about using advanced operation watch Advanced NSOperations - WWDC 2015 - Session 226 Video.

You will see:

  • How the code is encapsulated and more readable and more understandable. You can detect easily what is the duty of each file and even each method.

  • How loading images and their filtering is speeded up and being more efficient.

  • Notice that the app improvement isn't cause just using advanced Operations, I converted PhotoRecord class to struct. It was effective to improvement the app too. Look how I updated photos arrray in ListViewController after receiving details from internet or after downloading or filtering images. I used protocol for this. Also I used URLSession instead of simple Data for downloading images.

for using in your project

just import the Operations folder inside the ClassicPhotos-Advanced-Operation Folder in to your project and use it. Although this not a complete version of Advanced Operation library. you can download complete one from Advanced NSOperations - WWDC 2015 - Session 226 sample code.

I hope this sample code will be useful to you.

About

This is a sample code based on Ray Wenderlich tutorial for operation which improved it’s code to a better and more understandable code.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages