


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