SwiftUI Maps & Location: Fundamentals
This course shows you how to use MapKit and Core Location to integrate mapping and locations services into your app. With this technology, you can orientate your users, provide directions, and even create your own visual maps. By Brian Moakley.
Learning path
This is part of the iOS User Interfaces with SwiftUI learning path. View path.
Who is this for?
Beginning developers. Students should have a working knowledge of Swift and SwiftUI. Developers should be comfortable working with Xcode and know how to test an app on a device.
You’ll start by embedding a simple map in your app, then level up your skills by adding custom annotations. You’ll learn how to filter and take snapshots of maps. Then, you’ll learn the power of Core Location and how you can use it to provide directions, track distance and enable region monitoring.
Covered concepts
- SwiftUI and MapKit
- Annotating Maps
- Filtering and Searching Maps
- Taking MapSnapshots
- Requesting Permission
- Measuring Distance
- Geoencoding Locations
- Updating from the Background
- Region Monitoring
Part 1: MapKit
Learn the basics of MapKit and Core Location and discover some of the cool features that you can incorporate into your app.
In the Interesting Places sample app, you’ll learn how to embed a map into your SwiftUI app.
This episode covers some of the basics of map interaction and what you can do to enable or disable them.
Map annotations are critical for pointing out locations and points of interest. In this episode, you’ll learn how to add them to your map.
Now that you have one annotation, your challenge is to now add a whole lot more.
To really unlock the power of MapKit, you’ll need to use the UIKit version of the Map.
UIKit’s map annotations bring some different features to the table. Learn how these features will improve a user’s map experience.
Once you have a lot of map annotations, the results can be chaotic. Thankfully, you can cluster them as you’ll learn in this episode.
Learn how to determine the items that actually appear on your map.
Sometimes you don’t need an interactive map, just a picture of one. In this episode, you’ll learn how to take a snapshot.
This episode provides a review of MapKit then introduces Core Location.
Part 2: Core Location
Once you have a good idea on how to render maps, you can take it to the next level by using Core Location.
Before working with Core Location, it is critical to understand the various components that power it.
This episode breaks down the permission structure of Core Location and MapKit when requesting a user’s location.
Once you have two locations, you might want to measure the distance between them. Your challenge is to do this.
Learn how to receive location updates while your app is in the background.
Geocoding allows you to turn location coordinates into addresses, which you’ll learn about in this episode.
You’ve converted coordinates into addresses, but now your challenge is to convert addresses into coordinates.
Core Location provides excellent tools that allow you to track when a user has entered or exited a region. Let’s see how they work.
This episode concludes Core Location and wraps up the course with a review.