Skip to content

Commit b388ac7

Browse files
committed
Update LMViewModel.swift
1 parent 753c10a commit b388ac7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public final class LMViewModel: ILocationManagerViewModel{
6464
throw AsyncLocationErrors.streamingProcessHasAlreadyStarted
6565
}
6666

67-
state = .streaming
67+
setState(.streaming)
6868

6969
do {
7070
for try await coordinate in try await manager.start{
@@ -83,7 +83,7 @@ public final class LMViewModel: ILocationManagerViewModel{
8383

8484
manager.stop()
8585

86-
state = .idle
86+
setState(.idle)
8787

8888
#if DEBUG
8989
print("stop manager")
@@ -98,4 +98,10 @@ public final class LMViewModel: ILocationManagerViewModel{
9898
private func add(_ coordinate : CLLocation) {
9999
locations.append(coordinate)
100100
}
101+
102+
/// Set state
103+
/// - Parameter value: Streaming state
104+
private func setState(_ value: LocationStreamingState) {
105+
state = value
106+
}
101107
}

0 commit comments

Comments
 (0)