I am very new to objc and swift.
I am trying to access step count from HealthKit.
Can someone tell me whether my query is correct?
And can I call this query directly from my JS file or do I need to append it to an object in objc?
I am trying to access step count from HealthKit.
Can someone tell me whether my query is correct?
And can I call this query directly from my JS file or do I need to append it to an object in objc?
Code Block RCT_EXPORT_METHOD(updateStepsCount:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
Code Block @objc func updateStepsCount(_ statisticsCollection: HKStatisticsCollection, _ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping (RCTPromiseRejectBlock) -> Void) { let stepType = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)! let startDate = Calendar.current.date(byAdding: .day, value: -7, to: Date()) let anchorDate = Date.mondayAt12AM() let daily = DateComponents(day: 1) let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate) let query = HKStatisticsCollectionQuery(quantityType: stepType, quantitySamplePredicate: predicate, options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily) healthStore.execute(query) }