HealthData

class HealthData(var date: LocalDate? = null, var timeZoneId: String? = TimeZone.currentSystemDefault().id, var startZonedDateTime: String? = null, var endZonedDateTime: String? = null, var steps: Long? = null, var calories: Double? = null, var distance: Double? = null, var distanceUnits: DistanceUnit? = DistanceUnit.MILES, var activeMinutes: Long? = null)

HealthData — represents a daily snapshot of physical activity.

Typically used with SmartWalking or health provider integrations (e.g., Apple HealthKit, Google Health Connect, Fitbit) to record steps, calories, distance, and active minutes for a specific date.

Properties

  • date Date for this data point in ISO format (yyyy-MM-dd), e.g. "2025-08-22".

  • steps Total number of steps walked.

  • calories Calories burned (kcal).

  • distance Distance traveled.

  • distanceUnits Unit of measurement for distance (see DistanceUnit).

  • activeMinutes Number of minutes of active physical movement.

Notes

Android (Kotlin) — submitting steps

val today = HealthData(
date = "2025-08-22",
steps = 8743,
calories = 320.5,
distance = 6.7,
distanceUnits = DistanceUnit.KILOMETERS,
activeMinutes = 45
)

lifecycleScope.launch {
val ok = AFCore.smartwalking().submitActivities(listOf(today))
if (ok) Log.d("SmartWalking", "Submitted health data")
}

iOS (Swift) — submitting steps

let today = HealthData(
date: "2025-08-22",
steps: 8743,
calories: 320.5,
distance: 6.7,
distanceUnits: .kilometers,
activeMinutes: 45
)

Task {
do {
let ok = try await AFCore.shared.smartwalking().submitActivities([today])
if ok { print("Submitted health data") }
} catch {
print("Submit failed: \\(error.localizedDescription)")
}
}

Constructors

Link copied to clipboard
constructor(date: LocalDate? = null, timeZoneId: String? = TimeZone.currentSystemDefault().id, startZonedDateTime: String? = null, endZonedDateTime: String? = null, steps: Long? = null, calories: Double? = null, distance: Double? = null, distanceUnits: DistanceUnit? = DistanceUnit.MILES, activeMinutes: Long? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var date: LocalDate?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var steps: Long?
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String