Chapter 10. Location and mapping with Core Location and MapKit

 

This chapter covers

  • Introducing the Core Location and MapKit frameworks
  • Retrieving your current location, heading, and speed
  • Geocoding locations to display user-friendly locations
  • Displaying a map of your location

Whenever I can’t figure out where to eat, I turn to my favorite restaurant review app to make the difficult decision for me. It shows me all of the nearby restaurants and lists them according to their rating. I choose a place that I believe will be able to satisfy my enormous appetite. Not knowing where this place is, I load the directions into my favorite maps app to give me walking directions. As I turn, the map turns with me, orienting itself so that I know where to go. After a few minutes of walking, I’m ready to stuff my face.

There’s no need for me to manually enter my current street address when searching for a restaurant. It just knows where I am. There’s no need for me to tell the maps app that I’m facing a certain direction and to change its perspective. It just knows the direction I’m facing. These apps use Core Location to retrieve my current location as well as my heading. You’ll be learning how to use Core Location and MapKit in this chapter by creating an application called Speed Map, as shown in figure 10.1.

Figure 10.1. The application we’ll be building together will show your current location and the speed you’re traveling, and it will even track your location in real time within a map.

10.1. Introduction to the Core Location framework

10.2. Retrieving location, heading, and speed

10.3. Introduction to the MapKit framework

10.4. Summary