After struggling through the documentation on this one, I thought I'd share my attempt to bring Geofencing to SwiftUI. Excuse a less than perfect Swift Package. It's my first, but gotta start somewhere!
Your App --> Target - Your App --> Signing and Capabilities --> Add Capability --> Background Modes --> Location Updates
Add key Privacy - Location When In Use Usage Description
(and an actual description as the value) to your Info.plist
For example implementation see Sources/Views/ExampleView.swift
Xcode 11 includes support for Swift Package Manager. In order to add SwiftUIPolygonGeofence to your project in Xcode 11, from the File menu select Swift Packages and then select Add Package Dependency.
A dialogue will request the package repository URL which is:
https://github.com/zpg6/SwiftUIPolygonGeofence
After verifying the URL, Xcode will prompt you to select whether to pull a specific branch, commit or versioned release into your project.
Would love some help getting the inside/outside detection more accurate. Using a built in method with CGPoint because MKPolygons and MKOverlays are just the worst.
link |
Stars: 34 |
Last commit: 3 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics