8. Networking Code

The code in BrowseOverflow can parse data received from the Stack Overflow website and use it to build model objects that will be used in the app. The problem of fetching the data from the website in the first place still remains. In this chapter you’ll see how to build that code, and how to deal with the problem of talking to the outside world in a test-driven fashion.

On the face of it, the problem we have to deal with next in BrowseOverflow seems intractable: looking back to Chapter 3, “How to Write a Unit Test,” you’ll remember that unit tests are supposed to be fast, repeatable, and reliable. How do you achieve those properties when dealing with network code? So many issues can affect the performance and reliability of ...

Get Test-Driven iOS Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.