Skip to content

Commit b4b4422

Browse files
committed
Readme v0.1
1 parent 9c534bf commit b4b4422

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
11
# AsyncLocationKit
2+
3+
Wrapper for Apple `CoreLocation` framework with new Concurency Model. No more `delegate` patter or `completion blocks`.
4+
5+
```swift
6+
import AsyncLocationKit
7+
8+
let asyncLocationManager = AsyncLocationManager(desiredAccuracy: .bestAccuracy)
9+
10+
Task {
11+
let permission = await self.asyncLocationManager.requestAuthorizationWhenInUse() //returns CLAuthorizationStatus
12+
}
13+
```
14+
15+
You can use all methods from Apple `CLLocationManager`.
16+
17+
```swift
18+
Task {
19+
let coordinate = try await asyncLocationManager.requestLocation() //Request user location once
20+
}
21+
```
22+
23+
Start monitoring update of user location with `AsyncStream`.
24+
25+
```swift
26+
Task {
27+
for await locationUpdateEvent in await asyncLocationManager.startUpdatingLocation() {
28+
switch locationUpdateEvent {
29+
case .didUpdateLocations(let locations):
30+
// do something
31+
case .didFailWith(let error):
32+
// do something
33+
case .didPaused, .didResume:
34+
break
35+
}
36+
}
37+
}
38+
```
39+
40+
If `Task` was canceled, Stream finished automaticaly.

0 commit comments

Comments
 (0)