Post

Replies

Boosts

Views

Activity

Feature request: ability to handle digital crown click for app developers
I’m making WOD Insight - the Apple Watch app for CrossFit https://apps.apple.com/us/app/wod-insight-watch/id1495895643 The app helps crossfiters to track their progress during workouts. When they complete a set of push-ups, for example, they swipe on the watch screen, when they complete a set of squats, they swipe again, and so on. It would be incredibly useful for my app if a set could be completed with a Digital Crown click instead of the screen swipe. CrossFit is very competitive and saving these extra seconds on swipes is important for my users. Also, because CrossFitters working a lot with a barbell, the fingers get numb and not as sensitive to perform swipe on a tiny screen. It would be big deal for the usability of WOD Insight app if Apple would allow handling Digital Crown clicks with future updates. P.S. Gramin allows to do that, and this tiny detail prevents many of my users from switching to Apple Watch. Thank you!
0
0
569
Apr ’21
hkLiveWorkoutBuilder.statistics(for: heartRate) vs HKAnchoredObjectQuery when developing workout app
I'm making a workout app for Apple Watch. I start HKWorkoutSession, then associate it with HKLiveWorkoutBuilder and begin listening for heart rate and calorie changes. I have 2 options on how to get a heart rate or calories: Using HKLiveWorkoutBuilder statistics:  let heartRate = HKQuantityType.quantityType(forIdentifier: .heartRate),         let statistics = builder.statistics(for: heartRate){                   let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())         let value = statistics.mostRecentQuantity()?.doubleValue(for: heartRateUnit) 2. Executing HKAnchoredObjectQuery: let heartRateSample = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate) let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute()) let updateHandler: (HKAnchoredObjectQuery, [HKSample]?, [HKDeletedObject]?, HKQueryAnchor?, Error?) - () = { query, newResult, deleted, newAnchor, error in if let samples = newResult as? [HKQuantitySample] { guard samples.count 0 else { return } for sample in samples { let value = sample.quantity.doubleValue(for: heartRateUnit) value = Int(value) } } } heartRateQuery = HKAnchoredObjectQuery(type: heartRateSample!, predicate: nil, anchor: nil, limit: Int(HKObjectQueryNoLimit), resultsHandler: updateHandler) heartRateQuery!.updateHandler = updateHandler store?.execute(heartRateQuery!) Which of the options is preferable? Are there any benefits of using one over another? Big thanks for all your responses!
1
0
625
May ’21