WorkoutSession

data class WorkoutSession(val activityType: String, val startTimeIso: String, val endTimeIso: String, val startTimeEpochSeconds: Long, val endTimeEpochSeconds: Long, val durationMinutes: Double, val totalEnergyKilocalories: Double? = null, val totalDistanceMeters: Double? = null, val sourceName: String? = null)

A single workout / exercise session pulled from the device's health store (HealthKit HKWorkout on iOS, ExerciseSessionRecord on Android Health Connect).

Aggregate counterpart to HealthData (which is per-day steps + distance + calories): a workout is a discrete bounded activity with a start/end and a typed activityType.

Constructors

Link copied to clipboard
constructor(activityType: String, startTimeIso: String, endTimeIso: String, startTimeEpochSeconds: Long, endTimeEpochSeconds: Long, durationMinutes: Double, totalEnergyKilocalories: Double? = null, totalDistanceMeters: Double? = null, sourceName: String? = null)

Properties

Link copied to clipboard

Normalized activity identifier — e.g. "running", "cycling", "yoga", "walking", "hiit". Lowercased and underscore-joined; falls back to "other" when the platform type has no mapping.

Link copied to clipboard

Precomputed duration in minutes; may differ slightly from endTime - startTime when the source recorded paused intervals.

Link copied to clipboard

Workout end as Unix epoch seconds.

Link copied to clipboard

Workout end as an ISO-8601 UTC string.

Link copied to clipboard

Human-friendly source label (e.g. "Apple Watch", "Strava"), or null when unavailable.

Link copied to clipboard

Workout start as Unix epoch seconds — convenient for building a Swift Date(timeIntervalSince1970:) directly.

Link copied to clipboard

Workout start as an ISO-8601 UTC string (e.g. "2026-05-17T07:30:00Z"). Parse with kotlinx.datetime.Instant.parse(...) when you need a typed value.

Link copied to clipboard

Distance covered in meters, when available (running, walking, cycling, etc.); null for stationary activities or when not recorded.

Link copied to clipboard

Active energy burned in kilocalories, or null when the source did not record it.