


Wrapper for AppleCoreLocation framework with new Concurrency Model. No moredelegate pattern orcompletion blocks.
dependencies:[.package(url:"https://github.com/AsyncSwift/AsyncLocationKit.git",.upToNextMinor(from:"1.6.4"))]
pod 'AsyncLocationKit', :git => 'https://github.com/AsyncSwift/AsyncLocationKit.git', :tag => '1.6.4'
⚠️Initialize AsyncLocationManager only synchronously on MainThread
import AsyncLocationKitletasyncLocationManager=AsyncLocationManager(desiredAccuracy:.bestAccuracy)letpermission=awaitself.asyncLocationManager.requestAuthorizationWhenInUse() //returns CLAuthorizationStatus
You can use all methods from AppleCLLocationManager.
letcoordinate=tryawait asyncLocationManager.requestLocation() //Request user location once
Start monitoring update of user location withAsyncStream.
forawaitlocationUpdateEventinawait asyncLocationManager.startUpdatingLocation(){switch locationUpdateEvent{case.didUpdateLocations(let locations): // do something case.didFailWith(let error): // do somethingcase.didPaused,.didResume:break}}IfTask was cancelled, Stream finished automaticaly.