Friday, May 29, 2015

Network Request Templating

Soroush Khanlou:

This way, all the logic tied to a particular endpoint is located in one class, and any class using it gets fully baked objects in their completion block.


One of the big benefits to separating request building and response handling into their own objects is that users can inject whatever request builder they want. If their data comes back in MessagePack format, you can bring your own response handler when needed. The NSURLSession could also easily be injected.

Comments RSS · Twitter

Leave a Comment