init(workoutConfiguration:start:end:metadata:)
Creates a workout activity using the provided configuration, start date, end date, and metadata.
Declaration
init(workoutConfiguration: HKWorkoutConfiguration, start startDate: Date, end endDate: Date?, metadata: [String : Any]?)Parameters
- workoutConfiguration:
The configuration information for this part of the workout. For Swimbikerun workouts, the activity’s configuration must use the Swimming, Cycling, or Running activity types. For interval training, the activity’s configuration must use the same activity type as the containing workout.
- startDate:
The activity’s start date and time.
- endDate:
The activity’s end date and time. Set this value to
nilif the activity is still in progress. When set to a non-nilvalue, the end date must be equal to or later than its start date. A workout can’t have overlapping activities. - metadata:
Metadata that provides additional information about the activity.