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 2: What’s It Like There?

Or, Loading the Current Weather at a Location

Currently our app is loading weather forecasts, but the location is hard-coded. Today we’ll make the app usable by finding the device’s current location and then later allowing the user to enter a location—in both cases reverse-geocoding, or finding the real-world place name of that location, and using that name to load the weather.

Creating a Better Organization

First, instead of keeping all the code in the view controller, let’s get a better architecture in place. Then, as we add code to deal with location, we can do it in a clean and organized way. We’ll start with a data model class that will be responsible for loading and retaining weather data.

Creating a Data Model ...

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