<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutEvent/init(type:dateInterval:metadata:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKWorkoutEvent(cm)workoutEventWithType:dateInterval:metadata:"
  },
  "title" : "init(type:dateInterval:metadata:)"
}
-->

# init(type:dateInterval:metadata:)

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

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

## Parameters

`type`

The type of workout event. For a description of possible events, see [`HKWorkoutEventType`](/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 [`HKWorkoutEventType.lap`](/documentation/HealthKit/HKWorkoutEventType/lap) and [`HKWorkoutEventType.segment`](/documentation/HealthKit/HKWorkoutEventType/segment) event types support intervals with nonzero durations.

`metadata`

The metadata associated with the workout event.

## Return Value

A new workout event.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)