O'Reilly logo

Seven Mobile Apps in Seven Weeks by Tony Hillerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required