HealthKitUsageDemo
HealthKitUsageDemo copied to clipboard
Both read and write function for variety health-related property from your iPhone based on HealthKit
skoal
Skoal is a healthkit based library that supports reading and writing healthstore properties
Supported Properties
| Sample | HealthKit Identifier Type | Read | Write |
|---|---|---|---|
| StepCount | HKQuantityTypeIdentifierStepCount | ✓ | ✓ |
| Height | HKQuantityTypeIdentifierHeight | ✓ | ✓ |
| BodyMass | HKQuantityTypeIdentifierBodyMass | ✓ | ✓ |
| BodyMassIndex | HKQuantityTypeIdentifierBodyMassIndex | ✓ | ✓ |
| DistanceWalkingRunning | HKQuantityTypeIdentifierDistanceWalkingRunning | ✓ | ✓ |
| FlightsClimbed | HKQuantityTypeIdentifierFlightsClimbed | ✓ | ✓ |
| RespiratoryRate | HKQuantityTypeIdentifierRespiratoryRate | ✓ | ✓ |
| DietaryEnergyConsumed | HKQuantityTypeIdentifierDietaryEnergyConsumed | ✓ | ✓ |
| OxygenSaturation | HKQuantityTypeIdentifierOxygenSaturation | ✓ | |
| BodyTemperature | HKQuantityTypeIdentifierBodyTemperature | ✓ | ✓ |
| BloodGlucose | HKQuantityTypeIdentifierBloodGlucose | ✓ | ✓ |
| BloodPressureSystolic | HKQuantityTypeIdentifierBloodPressureSystolic | ✓ | ✓ |
| BloodPressureDiastolic | HKQuantityTypeIdentifierBloodPressureDiastolic | ✓ | ✓ |
| StandHour | HKCategoryTypeIdentifierAppleStandHour | ✓ | |
| BiologicalSex | biologicalSexWithError | ✓ | |
| DateOfBirth | dateOfBirthComponentsWithError | ✓ | |
| BloodType | bloodTypeWithError | ✓ | |
| FitzpatrickSkin | fitzpatrickSkinTypeWithError | ✓ | |
| SleepAnalysis | HKCategoryTypeIdentifierSleepAnalysis | ✓ | |
| MenstrualFlow | HKCategoryTypeIdentifierMenstrualFlow | ✓ | |
| IntermenstrualBleeding | HKCategoryTypeIdentifierIntermenstrualBleeding | ✓ | |
| SexualActivity | HKCategoryTypeIdentifierSexualActivity | ✓ |
License
skoaluse MIT license
Usage
- You should get HealthKit privacy permission before you use 'skoal'
- See the function by preview below
- Start the project to see the example
- Objective-C
[[skoal sharedInstance]requestHealthPermissionWithBlock:^(HealthStorePermissionResponse permissionResponse) {
if (permissionResponse == HealthStorePermissionResponseError) {
DLog(@"请求权限失败");
}else{
DLog(@"请求权限成功");
}
}];
- Swift
skoal.sharedInstance().requestHealthPermission { (response: HealthStorePermissionResponse) in
if response == HealthStorePermissionResponse.error {
print("请求失败")
} else {
print("请求成功")
}
}
| func preview1 | func preview2 |
|---|---|
![]() |
![]() |

