iOS library for background monitoring of a user's movement

What's New



What's Changed

  • Robustness: Run GeoMonitor on MainActor by @nighthawk in #6

Full Changelog: 0.1.3...0.2.0


A battery-efficient and privacy-friendly mini framework for monitoring the user's location, triggering callbacks when the user starts moving and monitoring whether the user approaches specified regions.

Relies on a mixture of techniques, such as:

  • Region-monitoring for detecting when the user leaves their current location
  • Region-monitoring for detecting when the user approaches pre-defined locations
  • Visit-monitoring for detecting when the user has arrived somewhere


  1. Configure your Target:
  • Go to Signing & Capabilities, Background Modes and make sure Location updates is ticket.
  • Go to Info, and make sure you have usage descriptions for "Privacy - Location Always", "Privacy - Location Always and When in Use", and "Privacy - Location When In Use" set.


GeoMonitor requires iOS 14+

self.monitor = GeoMonitor {
  // Fetch the latest regions; also called when entering one.
  // Make sure `region.identifier` is stable.
  let regions = await ...
  return circles = { CLCircularRegion(...) }
} onEvent: { event, currentLocation in
  switch event {
  case .departed(visit):
    // Called when a previously-visited location was left
  case .entered(region):
    // Called when entering a defined region.
    let notification = MyNotification(for: region)
  case .arrived(visit):
    // Called when a visit was registered
monitor.enableVisitMonitoring = true


Regular iOS restrictions apply, such as:

[...] When Background App Refresh is disabled, either for your app or for all apps, the user must explicitly launch your app to resume the delivery of all location-related events.


  • Swift Tools 5.5.0
View More Packages from this Author


  • None
Last updated: Sat Nov 25 2023 01:50:50 GMT-1000 (Hawaii-Aleutian Standard Time)