Home > Mobile >  How to read different workouts in HEALTHKIT SWIFT?
How to read different workouts in HEALTHKIT SWIFT?

Time:12-01

I’m new in Swift and I need to extract all data related to workouts from HealthKit and use it in JavaScript (I'm making a React Native app), so I made a query but its predicate only pass one workout e.g .cycling, what I need is to get all workouts, even if the user has it or not, let's say: get all workouts recorded (even if they are differents) by the user in a list.

I need: Running {...} Cycling {....} Pilates {...}

but I'm getting : Cycling 1 Cycling 2 Cycling 3

In brief, I need a predicate to do this. my code: enter image description here

CodePudding user response:

You should be passing a nil predicate to the HKSampleQuery to retrieve all workouts regardless of their type.

  • Related