duration()
Returns the total duration covering all the samples that match the query.
Declaration
func duration() -> HKQuantity?Discussion
If you set the duration option, this method returns a quantity object containing total duration covering all the samples that match the query; otherwise, it returns nil.