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

Get Seven Mobile Apps in Seven Weeks 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.