Contents

setCustomZoneConfiguration(_:for:)

Overrides the preferred zone configuration with a custom zone for the current workout.

Declaration

func setCustomZoneConfiguration(_ configuration: HKWorkoutZoneConfiguration?, for quantityType: HKQuantityType) async throws

Parameters

  • configuration:

    The zone configuration to use, or nil to remove any custom configuration and use the person’s preferred zones.

  • quantityType:

    The quantity type to which to apply the configuration.

Mentioned in

Discussion

Call this method before calling beginCollection(withStart:completion:) to apply custom zones. If you don’t set a custom configuration, the system uses the person’s preferred zone configuration from Health Settings for zone calculations. Custom configurations apply only to this workout and don’t modify the person’s preferred zones.

See Also

Configuring zone data