Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📍async/await CoreLocation

License

NotificationsYou must be signed in to change notification settings

AsyncSwift/AsyncLocationKit

Repository files navigation

Swift Package ManagerSwiftPlatforms

Wrapper for AppleCoreLocation framework with new Concurrency Model. No moredelegate pattern orcompletion blocks.

Install


SPM
dependencies:[.package(url:"https://github.com/AsyncSwift/AsyncLocationKit.git",.upToNextMinor(from:"1.6.4"))]

Cocoapods

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.

Packages

No packages published

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp