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:
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 = regions.map { 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)
notification.fire()
case .arrived(visit):
// Called when a visit was registered
}
}
monitor.enableVisitMonitoring = true
monitor.start()
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.
link |
Stars: 2 |
Last commit: 46 weeks ago |
Full Changelog: https://github.com/skedgo/GeoMonitor/compare/0.1.3...0.2.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics