kvs-coder / HealthKitReporter

HealthKitReporter. A wrapper for HealthKit framework. Helps to write or read data from Apple Health via HealthKit framework.
https://cocoapods.org/pods/HealthKitReporter
MIT License
70 stars 20 forks source link

Workout activity types #15

Closed opsb closed 3 years ago

opsb commented 3 years ago

Status

IN DEVELOPMENT

Currently there's no way to get the Workout activity name from the Workout struct. There is

self.workoutName = String(describing: workout.workoutActivityType)

at https://github.com/VictorKachalov/HealthKitReporter/blob/master/HealthKitReporter/Classes/Model/Payload/Workout.swift#L112 but it just returns the string "HKWorkoutActivityType".

This PR will add the activity type (using as a reference https://stackoverflow.com/questions/30175237/how-to-get-the-name-of-hkworkoutactivitytype-in-healthkit).

Open questions: 1) Should we add the field workout.activityType alongside the current workoutName (aligning with the enum type) 2) Naming of the string values - currently the format is presentation based, but as it's effectively a serialised value perhaps another format would make sense? (personally I'm happy with it as is but happy to go with whatever).

Migrations

NO

Description

Adding a string representation of the activity type to workout payload

Related PRs

pending: PR for health_kit_reporter