Chris' comments:
I try to make the the case for creating a simple wrapper around networking code. Rather than having a lot of asynchronous code (which is hard to test), I try to minimize the asynchronous part and instead use generics and structs to make it simpler and more testable.
I took this code from an existing app we wrote in production, and wrote a blog post about it in 2014: http://chris.eidhof.nl/posts/tiny-networking-in-swift.html. In my recent book Advanced Swift, we go into more detail explaining these techniques. Over the last years, a number of companies have used a variant of this library in production, and are quite happy with it.
After watching the talk, you'll see that there are a number of things that can be improved: how to parse other things than JSON? How can you make it asynchronous? How can you handle POST requests? I hope that you take these challenges, and see if you can add these features. It'll be lots of fun!
Comments
comments powered by Disqus