---
title: "init(type:dateInterval:metadata:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkworkoutevent/init(type:dateinterval:metadata:)"
---

# init(type:dateInterval:metadata:)

Instantiates and returns a new workout event with the specified type, date interval, and metadata.

## Declaration

```swift
convenience init(type: HKWorkoutEventType, dateInterval: DateInterval, metadata: [String : Any]?)
```

## Parameters

- `type`: The type of workout event. For a description of possible events, see doc://com.apple.healthkit/documentation/HealthKit/HKWorkoutEventType.
- `dateInterval`: Most event types support only date intervals with a zero-length duration. These intervals indicate a single point in time, represented by the interval’s doc://com.apple.documentation/documentation/Foundation/NSDateInterval/startDate property. Only doc://com.apple.healthkit/documentation/HealthKit/HKWorkoutEventType/lap and doc://com.apple.healthkit/documentation/HealthKit/HKWorkoutEventType/segment event types support intervals with nonzero durations.
- `metadata`: The metadata associated with the workout event.

## Return Value

Return Value A new workout event.
