Skip to content

Commit

Permalink
Fix Build error
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed May 24, 2024
1 parent d8700fb commit 8802391
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/SpeziTimedWalkTest/TimedWalkTestViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class TimedWalkTestViewModel {
func requestPedemoterAccess() {
#if !targetEnvironment(simulator)
guard CMPedometer.isStepCountingAvailable() else {
walkTestResponse = .failure(.unauthorized)
walkTestResponse = .failed(.unauthorized)
return
}

pedometer.queryPedometerData(from: .now, to: .now) { data, error in
if data != nil {
self.authorizationStatus = CMPedometer.authorizationStatus()
} else {
self.walkTestResponse = .failure(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
self.walkTestResponse = .failed(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
}
}
#else
Expand Down Expand Up @@ -81,7 +81,7 @@ class TimedWalkTestViewModel {
#if !targetEnvironment(simulator)
pedometer.queryPedometerData(from: walkTestStartDate, to: walkTestEndDate) { data, error in
if let data, let distance = data.distance?.doubleValue {
self.walkTestResponse = .success(
self.walkTestResponse = .completed(
TimedWalkTestResult(
stepCount: data.numberOfSteps.doubleValue,
distance: distance,
Expand All @@ -90,7 +90,7 @@ class TimedWalkTestViewModel {
)
)
} else {
self.walkTestResponse = .failure(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
self.walkTestResponse = .failed(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
}
}
#else
Expand Down

0 comments on commit 8802391

Please sign in to comment.