---
title: "init(activityType:locationType:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkworkoutsession/init(activitytype:locationtype:)"
---

# init(activityType:locationType:)

Returns a newly instantiated workout session.

## Declaration

```swift
init(activityType: HKWorkoutActivityType, locationType: HKWorkoutSessionLocationType)
```

## Parameters

- `activityType`: The type of activity being performed in the workout. For a list of possible activities, see doc://com.apple.healthkit/documentation/HealthKit/HKWorkoutActivityType.
- `locationType`: A value indicating whether the workout was performed indoors or outdoors. For a list of possible location values, see doc://com.apple.healthkit/documentation/HealthKit/HKWorkoutSessionLocationType.

## Return Value

Return Value A newly initialized workout session object for the specified activity type and location.

## Discussion

Discussion HealthKit uses the session’s workout activity and location type to fine tune Apple Watch’s sensors for the selected activity. All workout sessions generate higher-frequency heart rate samples; however, an outdoor cycling activity generates more accurate location data, while an indoor cycling activity does not.

## See Also

### Deprecated methods

- [init(configuration:)](healthkit/hkworkoutsession/init(configuration:).md)
- [activityType](healthkit/hkworkoutsession/activitytype.md)
- [locationType](healthkit/hkworkoutsession/locationtype.md)
