From the course: Advanced iOS App Development: MapKit & Core Location

Unlock the full course today

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

Regions

Regions - iOS Tutorial

From the course: Advanced iOS App Development: MapKit & Core Location

Start my 1-month free trial

Regions

- [Instructor] If you've asked your phone to remind you of something when you're leaving your house or work, you've used core location regions, also known as geofencing. Geofencing is informing the user if they're entering or exiting a geographic region. Using core location, you can set up geofencing in your apps. Let's write a new method to show us geofencing. We'll see when we enter the on-ramp on the freeway drive on Interstate 280 in the simulator. I've already figured out the coordinates for you, so you can get this set up as a constant in the class. Go to the properties for view controller and under the heading, add let onRampCoordinate equal CLLocationCoordinate2DMake. And that will be 37.3346 for the latitude, and the longitude will be -122.0345. So we have that coordinate now. We can use it later. Head over to the location instant methods and under disableLocationServices, make a new function called monitorRegion. I'm going to make it with a center parameter, and that'll be a…

Contents