From the course: Code Clinic: Swift

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution overview

Solution overview - Swift Tutorial

From the course: Code Clinic: Swift

Start my 1-month free trial

Solution overview

- [Instructor] Here's an overview of my solution to this problem. I made a simple application with some labels, and a map. The application uses a web service to get IP address information including the country, state, and city as well. It presents that information in labels, and shows the location on a map. If I stop the app, and take a look at my code you'll see that there isn't much code in this application. I have a simple user interface with a map, some labels, and a background for the labels so that they're more visible on top of the map. I have a struct for my IP data. I have one method that does all of the work called showIPData. This method can grab an IP address from a URL, or from a local file, and then it takes the data from that URL, and decodes it using a JSONDecoder. After that the data is placed inside of the labels. From there the longitude, and latitude data is extracted, and used to position the map.

Contents