Skip to content

Instantly share code, notes, and snippets.

@kenkeiter
Created April 15, 2017 16:25
Show Gist options
  • Save kenkeiter/418022bdf5eb395025478fb9d6e97b90 to your computer and use it in GitHub Desktop.
Save kenkeiter/418022bdf5eb395025478fb9d6e97b90 to your computer and use it in GitHub Desktop.
A full set of all HKObjectTypes (excluding correlation types, as of Apr. 15, 2017) because typing this out was a pain in the ass.
let hkTypes:Set<HKObjectType> = [
// body measurements
HKObjectType.quantityType(forIdentifier: .bodyMassIndex)!,
HKObjectType.quantityType(forIdentifier: .bodyFatPercentage)!,
HKObjectType.quantityType(forIdentifier: .height)!,
HKObjectType.quantityType(forIdentifier: .bodyMass)!,
HKObjectType.quantityType(forIdentifier: .leanBodyMass)!,
// fitness identifiers
HKObjectType.quantityType(forIdentifier: .stepCount)!,
HKObjectType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKObjectType.quantityType(forIdentifier: .distanceCycling)!,
HKObjectType.quantityType(forIdentifier: .distanceWheelchair)!,
HKObjectType.quantityType(forIdentifier: .basalEnergyBurned)!,
HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKObjectType.quantityType(forIdentifier: .flightsClimbed)!,
HKObjectType.quantityType(forIdentifier: .nikeFuel)!,
HKObjectType.quantityType(forIdentifier: .appleExerciseTime)!,
HKObjectType.quantityType(forIdentifier: .pushCount)!,
// vital signs identifiers
HKObjectType.quantityType(forIdentifier: .heartRate)!,
HKObjectType.quantityType(forIdentifier: .bodyTemperature)!,
HKObjectType.quantityType(forIdentifier: .basalBodyTemperature)!,
HKObjectType.quantityType(forIdentifier: .bloodPressureSystolic)!,
HKObjectType.quantityType(forIdentifier: .bloodPressureDiastolic)!,
HKObjectType.quantityType(forIdentifier: .respiratoryRate)!,
// results identifiers
HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!,
HKObjectType.quantityType(forIdentifier: .peripheralPerfusionIndex)!,
HKObjectType.quantityType(forIdentifier: .bloodGlucose)!,
HKObjectType.quantityType(forIdentifier: .numberOfTimesFallen)!,
HKObjectType.quantityType(forIdentifier: .electrodermalActivity)!,
HKObjectType.quantityType(forIdentifier: .inhalerUsage)!,
HKObjectType.quantityType(forIdentifier: .bloodAlcoholContent)!,
HKObjectType.quantityType(forIdentifier: .forcedVitalCapacity)!,
HKObjectType.quantityType(forIdentifier: .forcedExpiratoryVolume1)!,
HKObjectType.quantityType(forIdentifier: .peakExpiratoryFlowRate)!,
// nutrition identifiers
HKObjectType.quantityType(forIdentifier: .dietaryBiotin)!,
HKObjectType.quantityType(forIdentifier: .dietaryCaffeine)!,
HKObjectType.quantityType(forIdentifier: .dietaryCalcium)!,
HKObjectType.quantityType(forIdentifier: .dietaryCarbohydrates)!,
HKObjectType.quantityType(forIdentifier: .dietaryChloride)!,
HKObjectType.quantityType(forIdentifier: .dietaryCholesterol)!,
HKObjectType.quantityType(forIdentifier: .dietaryChromium)!,
HKObjectType.quantityType(forIdentifier: .dietaryCopper)!,
HKObjectType.quantityType(forIdentifier: .dietaryEnergyConsumed)!,
HKObjectType.quantityType(forIdentifier: .dietaryFatMonounsaturated)!,
HKObjectType.quantityType(forIdentifier: .dietaryFatPolyunsaturated)!,
HKObjectType.quantityType(forIdentifier: .dietaryFatSaturated)!,
HKObjectType.quantityType(forIdentifier: .dietaryFatTotal)!,
HKObjectType.quantityType(forIdentifier: .dietaryFiber)!,
HKObjectType.quantityType(forIdentifier: .dietaryFolate)!,
HKObjectType.quantityType(forIdentifier: .dietaryIodine)!,
HKObjectType.quantityType(forIdentifier: .dietaryIron)!,
HKObjectType.quantityType(forIdentifier: .dietaryMagnesium)!,
HKObjectType.quantityType(forIdentifier: .dietaryManganese)!,
HKObjectType.quantityType(forIdentifier: .dietaryMolybdenum)!,
HKObjectType.quantityType(forIdentifier: .dietaryNiacin)!,
HKObjectType.quantityType(forIdentifier: .dietaryPantothenicAcid)!,
HKObjectType.quantityType(forIdentifier: .dietaryPhosphorus)!,
HKObjectType.quantityType(forIdentifier: .dietaryPotassium)!,
HKObjectType.quantityType(forIdentifier: .dietaryProtein)!,
HKObjectType.quantityType(forIdentifier: .dietaryRiboflavin)!,
HKObjectType.quantityType(forIdentifier: .dietarySelenium)!,
HKObjectType.quantityType(forIdentifier: .dietarySodium)!,
HKObjectType.quantityType(forIdentifier: .dietarySugar)!,
HKObjectType.quantityType(forIdentifier: .dietaryThiamin)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminA)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminB12)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminB6)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminC)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminD)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminE)!,
HKObjectType.quantityType(forIdentifier: .dietaryVitaminK)!,
HKObjectType.quantityType(forIdentifier: .dietaryWater)!,
HKObjectType.quantityType(forIdentifier: .dietaryZinc)!,
// UV exposure identifiers
HKObjectType.quantityType(forIdentifier: .uvExposure)!,
// Category type identifiers
HKObjectType.categoryType(forIdentifier: .sleepAnalysis)!,
HKObjectType.categoryType(forIdentifier: .appleStandHour)!,
HKObjectType.categoryType(forIdentifier: .cervicalMucusQuality)!,
HKObjectType.categoryType(forIdentifier: .ovulationTestResult)!,
HKObjectType.categoryType(forIdentifier: .menstrualFlow)!,
HKObjectType.categoryType(forIdentifier: .intermenstrualBleeding)!,
HKObjectType.categoryType(forIdentifier: .sexualActivity)!,
HKObjectType.categoryType(forIdentifier: .mindfulSession)!,
// Workout type identifiers
HKObjectType.workoutType(),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment