{"id":21373701,"url":"https://github.com/Mist3r-R/location-based-ar","last_synced_at":"2025-07-13T08:30:42.024Z","repository":{"id":202163595,"uuid":"369368239","full_name":"Mist3r-R/location-based-ar","owner":"Mist3r-R","description":"A Swift Package for creating Augmented Reality applications for iOS with the use of Location-Based Services.","archived":false,"fork":false,"pushed_at":"2023-11-26T21:32:02.000Z","size":31627,"stargazers_count":27,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-22T08:37:37.314Z","etag":null,"topics":["ar","arkit","augmented-reality","corelocation","realitykit","swift","swift-package-manager","swiftpm","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mist3r-R.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-05-21T00:09:38.000Z","updated_at":"2024-08-06T20:41:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"a31da34a-7568-4a05-a98e-89b8309e6ee6","html_url":"https://github.com/Mist3r-R/location-based-ar","commit_stats":null,"previous_names":["mist3r-r/location-based-ar"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Mist3r-R/location-based-ar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mist3r-R%2Flocation-based-ar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mist3r-R%2Flocation-based-ar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mist3r-R%2Flocation-based-ar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mist3r-R%2Flocation-based-ar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mist3r-R","download_url":"https://codeload.github.com/Mist3r-R/location-based-ar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mist3r-R%2Flocation-based-ar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265109673,"owners_count":23712730,"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":["ar","arkit","augmented-reality","corelocation","realitykit","swift","swift-package-manager","swiftpm","swiftui"],"created_at":"2024-11-22T08:29:29.070Z","updated_at":"2025-07-13T08:30:37.011Z","avatar_url":"https://github.com/Mist3r-R.png","language":"Swift","funding_links":[],"categories":["OOM-Leaks-Crash"],"sub_categories":["AR-VR"],"readme":"# Location-Based Augmented Reality\n\nCombines most powerful and modern Augmented Reality tools for iOS devices with Location-Based Services to provide a unique experience of virtual items placing and tracking with respect to their real-world positions.\n\n\n# Requirements\n\n* iOS 14\n* Swift 5.3\n* XCode 12+\n\nThe package is build on top of `ARKit 4.0` and `RealityKit 2.0`, so hardware requirements are the same as for these Frameworks.\n\n**Note:** It is higly recommended to use device equipped with `LiDAR` as it significantly improves the overall AR experience as well as allows continuous tracking without spending extra time for environment processing.\n\n**Note (2):** Although the package can be used on devices without GPS module (e.g. iPad Wi-Fi only models), the performance of library can be reduced due to unstable location updates provided by CoreLocation service.\n\n# Installation\n\n## Swift Package Manager\n\nAdd the URL of this repository to your Xcode 12+ Project under `File \u003e Swift Packages`.\n\n`https://github.com/Mist3r-R/location-based-ar.git`\n\n# Usage\n\nThe library contains a Demo App, which covers most of use cases.\n\n## Setting Up the Project\n\nFirstly, add `NSLocationWhenInUseUsageDescription`, `NSLocationUsageDescription` and `NSLocationTemporaryUsageDescriptionDictionary` keys with descriptions to your `Info.plist` to be able to use CoreLocation. Note that library requires full accuracy mode (new in iOS 14), so the third key should be provided. Secondly, add `NSCameraUsageDescription` key which is required by ARKit. Finally, import this library: `import LocationBasedAR`.\n\n## Quick Start Guide\n\n`LBARView` can be used both with SwiftUI and UIKit frameworks. First, one should declare it as a property:\n\n```swift\n\nfunc makeUIView(context: Context) -\u003e LBARView {\n    let arView = LBARView(frame: .zero)\n    \n    // perform view's configuration\n    \n    return arView\n}\n\n```\n\nOnce the app is ready for AR experience, a native method for running a session should be called:\n\n```swift\n\nlet configuration: ARWorldTrackingConfiguration = LBARView.defaultConfiguration()\nlet options: ARSession.RunOptions = [\n    // options to run session\n]\narView.session.run(configuration, options: options)\n\n```\n\n`LBARView` expects to operate with its default or similar configurations. It can be specified based on application needs, however, the `.worldAlignment` property of session config should always be set to `.gravityAndHeading`. It also important to mention that `LBARView` **does not** listen to location updates by default and expects them to be provided externaly.\n\n`LBARView` comes with a special class which represents Location-Based anchors: `LBAnchor`. It is a custom subclass of `ARAnchor`, which inherits all the properties and behaviour of ARAnchor and can be further subclassed too. The class containes containes geolocation data and supports `SecureCoding`, which means it can be used in tasks related to sharing experience among different devices as it would be serialized with `ARWorldMap` object automatically.\n\n`LBARView` supports several approaches of location anchors creation:\n\n```swift\n\nlet location = CLLocation(/* params for initialization */)\narView.add(location: location) // CoreLocation's object\n\nlet placemark = Placemark(/* params for initialization */)\narView.add(placemark: placemark) // Custom object for location with associated name\n\nlet anchor = LBAnchor(/* params for initialization */)\narView.add(anchor: anchor) // Location-based anchor\n\nlet anchorEntity = AnchorEntity(/* params for initialization */)\narView.add(entity: anchorEntity) // RealityKit's Anchor Entity object\n\n```\n\n`LBAnchor` should not be added to `ARSession` manually as in such case `LBARView` won't be able to properly process location data and manage it during further tracking. However, when anchor is added via special methods, it can be further used as anchoring target for RealityKit's entities:\n\n```swift\n\nlet anchor: LBAnchor!\nlet anchorEntity = AnchorEntity(anchor: anchor)\nlet sphere = ModelEntity.sphereModel(radius: 0.1, color: anchor.locationEstimation.color, isMetallic: true)\nanchorEntity.addChild(sphere)\narView.scene.addAnchor(anchorEntity)\n\n```\n\nFinally, `LBARView` provides a set of tools for conversion between real-world coordinates to virtual world position and vice versa. \n\n\n## Additional Features\n\nBesides a great variety of conversions and transformations that can take place in Location-Based AR projects, the library comes with `RealityKit`'s extensions for *async loading* of remote Textures and Entities. These methods can be used in a similar to native `loadAsync` approach:\n\n```swift\n\nlet url = URL(string: \"https://developer.apple.com/augmented-reality/quick-look/models/retrotv/tv_retro.usdz\")!\n\nModelEntity.loadModelAsync(from: url) { result in\n            switch result {\n            case .failure(let err): // handle downloading error\n            case .success(let loadRequest):\n                _ /* AnyCancellable variable */ = loadRequest.sink(receiveCompletion: { loadCompletion in\n\n                    switch loadCompletion {\n                    case .failure(let error): // handle loading from local storage error\n                    case .finished: break\n                    }\n                    \n                }, receiveValue: { modelEntity in\n                    \n                    // do your stuff with received USDZ model\n                })\n            }\n        }\n\n```\n\n## Issues\n\nOne of the main issues is that CoreLocation does not provide reliable altitude estimations, thus the most stable approach to estimate vertical positions of model entities is to use the same altitude as the user's device has at the moment of estimation.\n\nSecond known issue is the limitation of tracking distance. Unfortunately, ARKit fails to track positions of anchors further than 100m away from the device, so the content should be placed closer in order to be rendered properly. \n\nFinally, sometimes CoreLocation fails to provide accurate values of device heading at the startup and thus the virtual content may appear on wrong positions which may improve over time. In addition, sometimes the direction of user movement can be estimated incorrectly and location updates will represent the moving in the opposite direction, which results in further distance from the anchor in virtual space than is should be.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMist3r-R%2Flocation-based-ar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMist3r-R%2Flocation-based-ar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMist3r-R%2Flocation-based-ar/lists"}