INNER CODE UNIT · Swift
handleEvent
carp-dk/flutter-plugins · ios-applications/pedometer-detector/pedometer-detector/ViewController.swift:38
func handleEvent(status: Int) {
let pedestrianStatus = status == 0 ? "STOPPED" : "WALKING"
print("Pedestrian Status: \(pedestrianStatus)")
}
func onCancel() {
if (running) {
pedometer.stopUpdates()
running = false
}
}
}
class StepCounter {
private let pedometer = CMPedometer()
private var running = false
private let available = CMPedometer.isStepCountingAvailable()