Proximity Reminders

Add location-based reminders so that when you are near a place of interest, you'll get a notification.

This was created for the Treehouse iOS Techdegree Unit 9 project.

Technical Background


To create and save reminders, I used Core Data. I created a Reminder entity which has attributes for:

  • title
  • notes
  • latitude
  • longitude
  • location name
  • whether or not the reminder is active
  • whether the user is reminded when entering or leaving the location

When a reminder is created, Core Location is used to start monitoring the location within a given radius. The region being monitored is assigned an identifier that matches the Reminder's unique identifier in the Core Data database so that the reminder can be fetched again later. When a user enters/exits the reminder location, CLLocationManager calls the appropriate delegate methods for locationManager(_: didEnterRegion) or locationManager(_: didExitRegion). The region identifier is used to fetch the matching reminder, and a local notification is triggered using the UserNotifications framework. The notification's message is set using the matching reminder's location name and title. 

Proximity Reminders App – Edit Reminder
Proximity Reminders App – Notification

The user can choose the reminder location with a searchable MKMapView. A UISearchController is used for this. When the user starts typing in the search bar an MKLocalSearch request is run to search for nearby points of interest. After a place is chosen, the reminder location radius is rendered on the map using MKMapViewDelegate.mapView(_: renderFor) making it easy to tell how close the user has to be to trigger the reminder notification.