Cocoa
This page is about programming Apple platforms with the Cocoa frameworks in Objective-C and Swift.
Tips for Structuring Networking and Controllers
Here are the tricks: views and view controllers should be main-thread-only. When you have a task in a controller that can block the main thread, make it isolatable and use a background queue of some kind — but keep that implementation detail hidden from the rest of the app. And any networking and parsing must be done in an object whose lifetime isn’t tied to the view controller’s lifetime.
— Brent Simmons
Last modified: 04 April 2016