NSOperations vs GCD

NSOperations

+ Fine control over handing network connections, you can cancel URL request operation or any other operation while it is operating.

+ Dependencies are the most famous reason for developers to choose NSOperations over GCD.

+ App can be architectured around the functional flow. WWDC 2015 got a fantastic talk on Advanced NSOperations explaining how WWDC 2015 app is completely developed using NSOperations.

+ Your app behaviours will sit tight and neatly separated.

– Lots of boiler plate code.

GCD

+ Easy to implement, as easy as writing a small function.

+ less code.

+ Definitely lot easier to implement.

+ Requires less time to understand the code base, might be even more easier with swift 3 GCD syntax.

+ Better place to start learning about asynchronous communications.

– Less control while making asynchronous calls, cannot cancel the connections once kicked off. 

Conclusion:

It all comes to what your app wants to do and how much control you need while making asynchronous connections, will your app benefit from having control to cancel and resume connections or do you prefer short and quick implementation. In the end both of them does same job in different ways.

Leave a Reply