Day 3: Expanding Our Horizons

Or, Adding Flexibility to the Code and the UI

Today we’ll make the code more flexible with two improvements. First we’ll take the API call out of the weather data model and put it into a generic HTTP client. This will give us a tour of some of the functional features of Swift, like generics and passing closures to methods.

Then we’ll get deeper into Auto Layout and make the UI more flexible in order to display on multiple screen sizes and geometries. The goal is to have as responsive a layout as we can. First, though, we’ll start by creating an HTTP client that knows how to parse and deserialize JSON into Swift objects.

A Better Deserialization Strategy

One of the first things we did yesterday was relieve the view ...

Get Seven Mobile Apps in Seven Weeks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.