Skip to content

Commit 9e78b5d

Browse files
committed
update
1 parent 34044ea commit 9e78b5d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Sources/d3-async-location/LocationManagerAsync.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
//
55
// Created by Igor on 03.02.2023.
66
//
7-
7+
import Foundation
88
import CoreLocation
99

1010

11-
/// Manager of locations streaming data asynchronously
11+
///Location manager streaming data asynchronously via property ``locations``
1212
@available(iOS 15.0, *)
1313
public final class LocationManagerAsync: NSObject, CLLocationManagerDelegate{
1414

@@ -27,6 +27,7 @@ public final class LocationManagerAsync: NSObject, CLLocationManagerDelegate{
2727

2828
private typealias StreamType = AsyncStream<CLLocation>.Continuation
2929

30+
/// Continuation asynchronosly passing location data
3031
private var stream: StreamType?{
3132
didSet {
3233
stream?.onTermination = { @Sendable _ in self.stop() }
@@ -104,10 +105,14 @@ public final class LocationManagerAsync: NSObject, CLLocationManagerDelegate{
104105
manager.startUpdatingLocation()
105106
}
106107

107-
private func yield(location : CLLocation){
108+
109+
/// Passing location data
110+
/// - Parameter location: Location data
111+
private func pass(location : CLLocation){
108112
stream?.yield(location)
109113
}
110114

115+
/// Convenience func to check status
111116
private func checkStatus() throws{
112117
if !isDetermined{
113118
throw LocationManagerErrors.statusIsNotDetermined
@@ -121,7 +126,7 @@ public final class LocationManagerAsync: NSObject, CLLocationManagerDelegate{
121126
/// - manager: Location manager
122127
/// - locations: Array of locations
123128
public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
124-
locations.forEach{ yield(location: $0) }
129+
locations.forEach{ pass(location: $0) }
125130
}
126131

127132
/// Determine status after the request permission

Sources/d3-async-location/viewmodel/LMViewModel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import SwiftUI
99
import CoreLocation
1010

11-
1211
/// Viewmodel posting locations
1312
@available(iOS 15.0, *)
1413
public final class LMViewModel: ILocationManagerViewModel{

0 commit comments

Comments
 (0)