{"id":23815224,"url":"https://github.com/yoman07/swiftbackgroundlocation","last_synced_at":"2025-09-06T23:32:19.589Z","repository":{"id":62456447,"uuid":"83969986","full_name":"yoman07/SwiftBackgroundLocation","owner":"yoman07","description":"Efficient and Easy Location Background Monitoring in Swift","archived":false,"fork":false,"pushed_at":"2017-12-21T10:45:56.000Z","size":198,"stargazers_count":73,"open_issues_count":4,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-01T23:46:34.009Z","etag":null,"topics":["background","cllregion","corelocation","geofencing","location","mapkit","region","swift","terminated"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoman07.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T12:57:27.000Z","updated_at":"2024-05-16T03:55:37.000Z","dependencies_parsed_at":"2022-11-02T00:16:58.213Z","dependency_job_id":null,"html_url":"https://github.com/yoman07/SwiftBackgroundLocation","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoman07%2FSwiftBackgroundLocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoman07%2FSwiftBackgroundLocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoman07%2FSwiftBackgroundLocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoman07%2FSwiftBackgroundLocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoman07","download_url":"https://codeload.github.com/yoman07/SwiftBackgroundLocation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232150097,"owners_count":18479580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["background","cllregion","corelocation","geofencing","location","mapkit","region","swift","terminated"],"created_at":"2025-01-02T04:15:25.415Z","updated_at":"2025-01-02T04:15:26.295Z","avatar_url":"https://github.com/yoman07.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftBackgroundLocation\n\n[![CI Status](http://img.shields.io/travis/yoman07/SwiftBackgroundLocation.svg?style=flat)](https://travis-ci.org/yoman07/SwiftBackgroundLocation)\n[![Version](https://img.shields.io/cocoapods/v/SwiftBackgroundLocation.svg?style=flat)](http://cocoapods.org/pods/SwiftBackgroundLocation)\n[![License](https://img.shields.io/cocoapods/l/SwiftBackgroundLocation.svg?style=flat)](http://cocoapods.org/pods/SwiftBackgroundLocation)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftBackgroundLocation.svg?style=flat)](http://cocoapods.org/pods/SwiftBackgroundLocation)\n\nSwiftBackground is the right choice to work easily and efficiently with Location Manager when your app is terminated or killed. It's based on region monitoring. Demo how it works (blue is normal tracking, red line is region based tracking):\n\n![](https://media.giphy.com/media/xUA7biAFYmwE8IKcDe/source.gif)\n\n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\nJust add in your app delegate for background location:\n\n```swift\n    var backgroundLocationManager = BackgroundLocationManager()\n    \n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -\u003e Bool {\n        \n         backgroundLocationManager.startBackground() { result in\n                if case let .Success(location) = result {\n                    LocationLogger().writeLocationToFile(location: location)\n                }\n        }\n\n        return true\n    }\n```\n\nYou can set up radius for background location:\n\n```swift\n    let regionConfig = RegionConfig(regionRadius: 25.0)\n    var backgroundLocationManager = BackgroundLocationManager(regionConfig: regionConfig) \n    \n```\n\nGetting permission (`.always` or `.whenInUse`) for location tracking:\n\n```swift\nlocationManager.manager(for: .always, completion: { result in\n            if case let .Success(manager) = result {\n                \n            }\n\n\n})\n```\n\nLocation tracking with listener:\n\n```swift\nlocationManager.manager(for: .always, completion: { result in\n            if case let .Success(manager) = result {\n                manager.startUpdatingLocation(isHeadingEnabled: true) { [weak self] result in\n                    if case let .Success(locationHeading) = result, let location = locationHeading.location {\n                        self?.updateLocation(location: location)\n                    }\n                }\n            }\n\n})\n```\n\nGetting heading needs additional hardware and hence wont work on simulator.\n\n\n## Requirements\n\n## Installation\n\nSwiftBackgroundLocation is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"SwiftBackgroundLocation\"\n```\n\nYou must add NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key to your project’s Info.plist containing the message to be displayed to the user at the prompt. If you need always location, you should add both.\n\n```\n\u003ckey\u003eNSLocationAlwaysUsageDescription\u003c/key\u003e\n\u003cstring\u003e$(PRODUCT_NAME) needs location always usage for recording in background.\u003c/string\u003e\n```\n\n```\n\u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n\u003cstring\u003e$(PRODUCT_NAME) needs location when in use for recording in foreground.\u003c/string\u003e\n```\n\nThe user will not be prompted unless one of these are added to the Info.plist.\n\n\n## Author\n\nyoman07, roman.barzyczak+web@gmail.com\n\n## License\n\nSwiftBackgroundLocation is available under the MIT license. See the LICENSE file for more info.\n\n### Contact \u0026 Questions\n\nIf you have any questions, fell free to send me a mail.\nYou can also fork this project, or open an issue \n\n### Contributions\nSwiftBackgroundLocation is currently lead by:\n\n-  Roman Barzyczak  (`GitHub \u003chttps://github.com/yoman07`__  `Roman Barzyczak \u003chttps://github.com/yoman07\u003e`__)\n\nwith contributions from:\n\n- `Andrew Sowers \u003chttps://github.com/asowers1\u003e`__\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoman07%2Fswiftbackgroundlocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoman07%2Fswiftbackgroundlocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoman07%2Fswiftbackgroundlocation/lists"}