Slide 10
Slide 10 text
let store = HKHealthStore()
let type =
HKSampleType.quantityType(forIdentifier: .stepCount)!
let predicate =
HKQuery.predicateForSamples(withStart: start, end: end)
let query =
HKSampleQuery(sampleType: type,
predicate: predicate,
limit: HKObjectQueryNoLimit,
sortDescriptors: nil)
{ (query, result, error) in
let result = result as! [HKQuantitySample]
let sum = result(0) {
$0 + $1.quantity.doubleValue(for: .count())
}
print(sum)
}
store.execute(query)
)FBMUI,JUΛར༻͢Δ