Which HKUnit for Average walking speed?

I am using statistical collection queries to query data like steps, average walking speed, etc, from the health kit store.

Following is my initial result handler code...

Code Block
NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDate *endDate = date;
    NSDate *startDate = [calendar dateByAddingUnit:NSCalendarUnitYear
                                             value:-1
                                            toDate:endDate
                                            options:0];
    [yearlyResults enumerateStatisticsFromDate:startDate
                                  toDate:endDate
                               withBlock:^(HKStatistics *result, BOOL *stop) {
        
if (identifier== HKQuantityTypeIdentifierWalkingSpeed) {
        HKQuantity *quantity = result.averageQuantity;
        value = [quantity doubleValueForUnit:[HKUnit countUnit]];
    }
        
    }];

In the last line of code I get the following error message...

Code Block
'Attempt to convert incompatible units: m/s, count'


Even Meter unit doesn't work. I need to know which is the right HKUnit to get walking speed.

Replies

i am still stuck here.
The unit for speed is distance per time e.g. meters per second. Something like the following should work

HKUnit.init(from: “m/s”)

or

HKUnit.meter().unitDivided(by: HKUnit.second())