O'Reilly logo

Core Data in Swift by Marcus S. Zarra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the Network Operations

The last question to be answered is where to keep these NSOperation subclasses. Ideally they should be created, accessed, and referenced from a central location. The AppDelegate could be used, but the AppDelegate tends to turn into a bit of a dumping ground. A superior location would be in the DataController since the network operations have a close tie with Core Data. In addition, since the DataController is being passed through the view controllers already, it’s a small change to include convenience methods to kick off network operations and let the DataController house the NSOperationQueue that runs the operations.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required