connect Apple Health Kit
iOS primary setup flow — requests HealthKit permissions and registers the device.
This is the recommended entry point for iOS consumers. It:
Requests HealthKit read permissions (step count, distance, calories, duration).
Calls registerUser with DeviceType.IOS.
If registration succeeds, enables auto-sync automatically.
Platform: iOS and watchOS only. On Android, use connectGoogleHealthConnect.
Swift
Task {
do {
let profile = try await AFCore.shared.smartWalking()
.connectAppleHealthKit(deviceId: UIDevice.current.identifierForVendor!.uuidString)
if profile.isConnected {
showMessage("HealthKit connected — auto-sync enabled")
}
} catch {
showError("HealthKit connection failed: \(error.localizedDescription)")
}
}Content copied to clipboard
Return
A SmartWalkingProfile reflecting the registration state.
Parameters
device Id
A stable device identifier (e.g. UIDevice.identifierForVendor).
Throws
if permission request fails or registration fails.