|
9
|
9
|
enum TypeCategory: String, CaseIterable {
|
|
10
|
10
|
case activity = "Activity"
|
|
11
|
11
|
case heart = "Heart"
|
|
|
12
|
+ case mobility = "Mobility"
|
|
12
|
13
|
case respiratory = "Respiratory"
|
|
13
|
14
|
case sleep = "Sleep"
|
|
14
|
15
|
case hearing = "Hearing"
|
|
15
|
16
|
case body = "Body"
|
|
|
17
|
+ case nutrition = "Nutrition"
|
|
|
18
|
+ case reproductive = "Reproductive Health"
|
|
|
19
|
+ case symptoms = "Symptoms"
|
|
|
20
|
+ case other = "Other"
|
|
16
|
21
|
}
|
|
17
|
22
|
|
|
18
|
23
|
struct MonitoredType: Identifiable, @unchecked Sendable {
|
|
2179
|
2184
|
result.append(MonitoredType(id: t?.identifier ?? id.rawValue, displayName: name, category: cat, isEnabledByDefault: on, objectType: t))
|
|
2180
|
2185
|
}
|
|
2181
|
2186
|
|
|
|
2187
|
+ func addQtyRaw(_ rawIdentifier: String, _ name: String, _ cat: TypeCategory, on: Bool = false) {
|
|
|
2188
|
+ let id = HKQuantityTypeIdentifier(rawValue: rawIdentifier)
|
|
|
2189
|
+ let t = HKObjectType.quantityType(forIdentifier: id)
|
|
|
2190
|
+ result.append(MonitoredType(id: t?.identifier ?? rawIdentifier, displayName: name, category: cat, isEnabledByDefault: on, objectType: t))
|
|
|
2191
|
+ }
|
|
|
2192
|
+
|
|
2182
|
2193
|
func addCat(_ id: HKCategoryTypeIdentifier, _ name: String, _ cat: TypeCategory, on: Bool) {
|
|
2183
|
2194
|
let t = HKObjectType.categoryType(forIdentifier: id)
|
|
2184
|
2195
|
result.append(MonitoredType(id: t?.identifier ?? id.rawValue, displayName: name, category: cat, isEnabledByDefault: on, objectType: t))
|
|
2185
|
2196
|
}
|
|
2186
|
2197
|
|
|
|
2198
|
+ func addCatRaw(_ rawIdentifier: String, _ name: String, _ cat: TypeCategory, on: Bool = false) {
|
|
|
2199
|
+ let id = HKCategoryTypeIdentifier(rawValue: rawIdentifier)
|
|
|
2200
|
+ let t = HKObjectType.categoryType(forIdentifier: id)
|
|
|
2201
|
+ result.append(MonitoredType(id: t?.identifier ?? rawIdentifier, displayName: name, category: cat, isEnabledByDefault: on, objectType: t))
|
|
|
2202
|
+ }
|
|
|
2203
|
+
|
|
2187
|
2204
|
let workout = HKObjectType.workoutType()
|
|
2188
|
2205
|
result.append(MonitoredType(id: workout.identifier, displayName: "Workouts", category: .activity, isEnabledByDefault: true, objectType: workout))
|
|
2189
|
2206
|
|
|
2192
|
2209
|
addQty(.activeEnergyBurned, "Active Energy", .activity, on: true)
|
|
2193
|
2210
|
addQty(.appleExerciseTime, "Exercise Minutes", .activity, on: true)
|
|
2194
|
2211
|
addCat(.appleStandHour, "Stand Hours", .activity, on: true)
|
|
|
2212
|
+ addQtyRaw("HKQuantityTypeIdentifierBasalEnergyBurned", "Basal Energy", .activity)
|
|
|
2213
|
+ addQtyRaw("HKQuantityTypeIdentifierFlightsClimbed", "Flights Climbed", .activity)
|
|
|
2214
|
+ addQtyRaw("HKQuantityTypeIdentifierAppleMoveTime", "Move Time", .activity)
|
|
|
2215
|
+ addQtyRaw("HKQuantityTypeIdentifierAppleStandTime", "Stand Time", .activity)
|
|
|
2216
|
+ addQtyRaw("HKQuantityTypeIdentifierDistanceCycling", "Cycling Distance", .activity)
|
|
|
2217
|
+ addQtyRaw("HKQuantityTypeIdentifierDistanceSwimming", "Swimming Distance", .activity)
|
|
|
2218
|
+ addQtyRaw("HKQuantityTypeIdentifierSwimmingStrokeCount", "Swimming Stroke Count", .activity)
|
|
|
2219
|
+ addQtyRaw("HKQuantityTypeIdentifierDistanceDownhillSnowSports", "Downhill Snow Sports Distance", .activity)
|
|
|
2220
|
+ addQtyRaw("HKQuantityTypeIdentifierPushCount", "Wheelchair Pushes", .activity)
|
|
|
2221
|
+ addQtyRaw("HKQuantityTypeIdentifierDistanceWheelchair", "Wheelchair Distance", .activity)
|
|
2195
|
2222
|
|
|
2196
|
2223
|
addQty(.heartRate, "Heart Rate", .heart, on: true)
|
|
2197
|
2224
|
addQty(.restingHeartRate, "Resting Heart Rate", .heart, on: true)
|
|
2198
|
2225
|
addCat(.highHeartRateEvent, "High Heart Rate Notifications", .heart, on: true)
|
|
|
2226
|
+ addQtyRaw("HKQuantityTypeIdentifierWalkingHeartRateAverage", "Walking Heart Rate Average", .heart)
|
|
|
2227
|
+ addQtyRaw("HKQuantityTypeIdentifierHeartRateVariabilitySDNN", "Heart Rate Variability", .heart)
|
|
|
2228
|
+ addQtyRaw("HKQuantityTypeIdentifierAtrialFibrillationBurden", "Atrial Fibrillation Burden", .heart)
|
|
|
2229
|
+ addCatRaw("HKCategoryTypeIdentifierLowHeartRateEvent", "Low Heart Rate Notifications", .heart)
|
|
|
2230
|
+ addCatRaw("HKCategoryTypeIdentifierIrregularHeartRhythmEvent", "Irregular Rhythm Notifications", .heart)
|
|
2199
|
2231
|
|
|
2200
|
2232
|
addQty(.respiratoryRate, "Respiratory Rate", .respiratory, on: true)
|
|
|
2233
|
+ addQtyRaw("HKQuantityTypeIdentifierOxygenSaturation", "Blood Oxygen", .respiratory)
|
|
|
2234
|
+ addQtyRaw("HKQuantityTypeIdentifierForcedVitalCapacity", "Forced Vital Capacity", .respiratory)
|
|
|
2235
|
+ addQtyRaw("HKQuantityTypeIdentifierForcedExpiratoryVolume1", "Forced Expiratory Volume, 1 sec", .respiratory)
|
|
|
2236
|
+ addQtyRaw("HKQuantityTypeIdentifierPeakExpiratoryFlowRate", "Peak Expiratory Flow Rate", .respiratory)
|
|
|
2237
|
+ addQtyRaw("HKQuantityTypeIdentifierInhalerUsage", "Inhaler Usage", .respiratory)
|
|
2201
|
2238
|
|
|
2202
|
2239
|
addCat(.sleepAnalysis, "Sleep", .sleep, on: true)
|
|
2203
|
2240
|
|
|
2204
|
2241
|
addQty(.environmentalAudioExposure, "Environmental Sound Levels", .hearing, on: false)
|
|
2205
|
2242
|
addQty(.headphoneAudioExposure, "Headphone Audio Levels", .hearing, on: false)
|
|
|
2243
|
+ addCatRaw("HKCategoryTypeIdentifierHeadphoneAudioExposureEvent", "Headphone Audio Notifications", .hearing)
|
|
|
2244
|
+ addCatRaw("HKCategoryTypeIdentifierEnvironmentalAudioExposureEvent", "Environmental Audio Notifications", .hearing)
|
|
2206
|
2245
|
|
|
2207
|
2246
|
addQty(.bodyMass, "Body Mass", .body, on: false)
|
|
2208
|
2247
|
addQty(.vo2Max, "VO2 Max", .body, on: false)
|
|
|
2248
|
+ addQtyRaw("HKQuantityTypeIdentifierBodyMassIndex", "Body Mass Index", .body)
|
|
|
2249
|
+ addQtyRaw("HKQuantityTypeIdentifierBodyFatPercentage", "Body Fat Percentage", .body)
|
|
|
2250
|
+ addQtyRaw("HKQuantityTypeIdentifierHeight", "Height", .body)
|
|
|
2251
|
+ addQtyRaw("HKQuantityTypeIdentifierLeanBodyMass", "Lean Body Mass", .body)
|
|
|
2252
|
+ addQtyRaw("HKQuantityTypeIdentifierWaistCircumference", "Waist Circumference", .body)
|
|
|
2253
|
+ addQtyRaw("HKQuantityTypeIdentifierBodyTemperature", "Body Temperature", .body)
|
|
|
2254
|
+ addQtyRaw("HKQuantityTypeIdentifierBasalBodyTemperature", "Basal Body Temperature", .body)
|
|
|
2255
|
+ addQtyRaw("HKQuantityTypeIdentifierBloodPressureSystolic", "Blood Pressure Systolic", .body)
|
|
|
2256
|
+ addQtyRaw("HKQuantityTypeIdentifierBloodPressureDiastolic", "Blood Pressure Diastolic", .body)
|
|
|
2257
|
+ addQtyRaw("HKQuantityTypeIdentifierBloodGlucose", "Blood Glucose", .body)
|
|
|
2258
|
+ addQtyRaw("HKQuantityTypeIdentifierInsulinDelivery", "Insulin Delivery", .body)
|
|
|
2259
|
+ addQtyRaw("HKQuantityTypeIdentifierPeripheralPerfusionIndex", "Peripheral Perfusion Index", .body)
|
|
|
2260
|
+ addQtyRaw("HKQuantityTypeIdentifierElectrodermalActivity", "Electrodermal Activity", .body)
|
|
|
2261
|
+
|
|
|
2262
|
+ addQtyRaw("HKQuantityTypeIdentifierWalkingSpeed", "Walking Speed", .mobility)
|
|
|
2263
|
+ addQtyRaw("HKQuantityTypeIdentifierWalkingStepLength", "Walking Step Length", .mobility)
|
|
|
2264
|
+ addQtyRaw("HKQuantityTypeIdentifierWalkingAsymmetryPercentage", "Walking Asymmetry", .mobility)
|
|
|
2265
|
+ addQtyRaw("HKQuantityTypeIdentifierWalkingDoubleSupportPercentage", "Double Support Time", .mobility)
|
|
|
2266
|
+ addQtyRaw("HKQuantityTypeIdentifierSixMinuteWalkTestDistance", "Six-Minute Walk Distance", .mobility)
|
|
|
2267
|
+ addQtyRaw("HKQuantityTypeIdentifierStairAscentSpeed", "Stair Ascent Speed", .mobility)
|
|
|
2268
|
+ addQtyRaw("HKQuantityTypeIdentifierStairDescentSpeed", "Stair Descent Speed", .mobility)
|
|
|
2269
|
+ addQtyRaw("HKQuantityTypeIdentifierAppleWalkingSteadiness", "Walking Steadiness", .mobility)
|
|
|
2270
|
+ addCatRaw("HKCategoryTypeIdentifierAppleWalkingSteadinessEvent", "Walking Steadiness Notifications", .mobility)
|
|
|
2271
|
+
|
|
|
2272
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryEnergyConsumed", "Dietary Energy", .nutrition)
|
|
|
2273
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryWater", "Water", .nutrition)
|
|
|
2274
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryProtein", "Protein", .nutrition)
|
|
|
2275
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryCarbohydrates", "Carbohydrates", .nutrition)
|
|
|
2276
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryFiber", "Fiber", .nutrition)
|
|
|
2277
|
+ addQtyRaw("HKQuantityTypeIdentifierDietarySugar", "Sugar", .nutrition)
|
|
|
2278
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryFatTotal", "Total Fat", .nutrition)
|
|
|
2279
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryFatSaturated", "Saturated Fat", .nutrition)
|
|
|
2280
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryFatMonounsaturated", "Monounsaturated Fat", .nutrition)
|
|
|
2281
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryFatPolyunsaturated", "Polyunsaturated Fat", .nutrition)
|
|
|
2282
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryCholesterol", "Cholesterol", .nutrition)
|
|
|
2283
|
+ addQtyRaw("HKQuantityTypeIdentifierDietarySodium", "Sodium", .nutrition)
|
|
|
2284
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryPotassium", "Potassium", .nutrition)
|
|
|
2285
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryCalcium", "Calcium", .nutrition)
|
|
|
2286
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryIron", "Iron", .nutrition)
|
|
|
2287
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryMagnesium", "Magnesium", .nutrition)
|
|
|
2288
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryZinc", "Zinc", .nutrition)
|
|
|
2289
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminA", "Vitamin A", .nutrition)
|
|
|
2290
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminB6", "Vitamin B6", .nutrition)
|
|
|
2291
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminB12", "Vitamin B12", .nutrition)
|
|
|
2292
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminC", "Vitamin C", .nutrition)
|
|
|
2293
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminD", "Vitamin D", .nutrition)
|
|
|
2294
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminE", "Vitamin E", .nutrition)
|
|
|
2295
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryVitaminK", "Vitamin K", .nutrition)
|
|
|
2296
|
+ addQtyRaw("HKQuantityTypeIdentifierDietaryCaffeine", "Caffeine", .nutrition)
|
|
|
2297
|
+
|
|
|
2298
|
+ addCatRaw("HKCategoryTypeIdentifierMenstrualFlow", "Menstrual Flow", .reproductive)
|
|
|
2299
|
+ addCatRaw("HKCategoryTypeIdentifierIntermenstrualBleeding", "Intermenstrual Bleeding", .reproductive)
|
|
|
2300
|
+ addCatRaw("HKCategoryTypeIdentifierOvulationTestResult", "Ovulation Test Result", .reproductive)
|
|
|
2301
|
+ addCatRaw("HKCategoryTypeIdentifierCervicalMucusQuality", "Cervical Mucus Quality", .reproductive)
|
|
|
2302
|
+ addCatRaw("HKCategoryTypeIdentifierSexualActivity", "Sexual Activity", .reproductive)
|
|
|
2303
|
+ addCatRaw("HKCategoryTypeIdentifierPregnancy", "Pregnancy", .reproductive)
|
|
|
2304
|
+ addCatRaw("HKCategoryTypeIdentifierLactation", "Lactation", .reproductive)
|
|
|
2305
|
+ addCatRaw("HKCategoryTypeIdentifierContraceptive", "Contraceptive", .reproductive)
|
|
|
2306
|
+
|
|
|
2307
|
+ addCatRaw("HKCategoryTypeIdentifierAbdominalCramps", "Abdominal Cramps", .symptoms)
|
|
|
2308
|
+ addCatRaw("HKCategoryTypeIdentifierAcne", "Acne", .symptoms)
|
|
|
2309
|
+ addCatRaw("HKCategoryTypeIdentifierAppetiteChanges", "Appetite Changes", .symptoms)
|
|
|
2310
|
+ addCatRaw("HKCategoryTypeIdentifierBloating", "Bloating", .symptoms)
|
|
|
2311
|
+ addCatRaw("HKCategoryTypeIdentifierBreastPain", "Breast Pain", .symptoms)
|
|
|
2312
|
+ addCatRaw("HKCategoryTypeIdentifierChestTightnessOrPain", "Chest Tightness or Pain", .symptoms)
|
|
|
2313
|
+ addCatRaw("HKCategoryTypeIdentifierChills", "Chills", .symptoms)
|
|
|
2314
|
+ addCatRaw("HKCategoryTypeIdentifierConstipation", "Constipation", .symptoms)
|
|
|
2315
|
+ addCatRaw("HKCategoryTypeIdentifierCoughing", "Coughing", .symptoms)
|
|
|
2316
|
+ addCatRaw("HKCategoryTypeIdentifierDiarrhea", "Diarrhea", .symptoms)
|
|
|
2317
|
+ addCatRaw("HKCategoryTypeIdentifierDizziness", "Dizziness", .symptoms)
|
|
|
2318
|
+ addCatRaw("HKCategoryTypeIdentifierFatigue", "Fatigue", .symptoms)
|
|
|
2319
|
+ addCatRaw("HKCategoryTypeIdentifierFever", "Fever", .symptoms)
|
|
|
2320
|
+ addCatRaw("HKCategoryTypeIdentifierHeadache", "Headache", .symptoms)
|
|
|
2321
|
+ addCatRaw("HKCategoryTypeIdentifierHeartburn", "Heartburn", .symptoms)
|
|
|
2322
|
+ addCatRaw("HKCategoryTypeIdentifierHotFlashes", "Hot Flashes", .symptoms)
|
|
|
2323
|
+ addCatRaw("HKCategoryTypeIdentifierLossOfSmell", "Loss of Smell", .symptoms)
|
|
|
2324
|
+ addCatRaw("HKCategoryTypeIdentifierLossOfTaste", "Loss of Taste", .symptoms)
|
|
|
2325
|
+ addCatRaw("HKCategoryTypeIdentifierLowerBackPain", "Lower Back Pain", .symptoms)
|
|
|
2326
|
+ addCatRaw("HKCategoryTypeIdentifierMemoryLapse", "Memory Lapse", .symptoms)
|
|
|
2327
|
+ addCatRaw("HKCategoryTypeIdentifierMoodChanges", "Mood Changes", .symptoms)
|
|
|
2328
|
+ addCatRaw("HKCategoryTypeIdentifierNausea", "Nausea", .symptoms)
|
|
|
2329
|
+ addCatRaw("HKCategoryTypeIdentifierPelvicPain", "Pelvic Pain", .symptoms)
|
|
|
2330
|
+ addCatRaw("HKCategoryTypeIdentifierRapidPoundingOrFlutteringHeartbeat", "Rapid or Pounding Heartbeat", .symptoms)
|
|
|
2331
|
+ addCatRaw("HKCategoryTypeIdentifierRunnyNose", "Runny Nose", .symptoms)
|
|
|
2332
|
+ addCatRaw("HKCategoryTypeIdentifierShortnessOfBreath", "Shortness of Breath", .symptoms)
|
|
|
2333
|
+ addCatRaw("HKCategoryTypeIdentifierSinusCongestion", "Sinus Congestion", .symptoms)
|
|
|
2334
|
+ addCatRaw("HKCategoryTypeIdentifierSkippedHeartbeat", "Skipped Heartbeat", .symptoms)
|
|
|
2335
|
+ addCatRaw("HKCategoryTypeIdentifierSleepChanges", "Sleep Changes", .symptoms)
|
|
|
2336
|
+ addCatRaw("HKCategoryTypeIdentifierSoreThroat", "Sore Throat", .symptoms)
|
|
|
2337
|
+ addCatRaw("HKCategoryTypeIdentifierVaginalDryness", "Vaginal Dryness", .symptoms)
|
|
|
2338
|
+ addCatRaw("HKCategoryTypeIdentifierVomiting", "Vomiting", .symptoms)
|
|
|
2339
|
+ addCatRaw("HKCategoryTypeIdentifierWheezing", "Wheezing", .symptoms)
|
|
|
2340
|
+
|
|
|
2341
|
+ addCatRaw("HKCategoryTypeIdentifierMindfulSession", "Mindful Sessions", .other)
|
|
|
2342
|
+ addCatRaw("HKCategoryTypeIdentifierToothbrushingEvent", "Toothbrushing", .other)
|
|
|
2343
|
+ addCatRaw("HKCategoryTypeIdentifierHandwashingEvent", "Handwashing", .other)
|
|
2209
|
2344
|
|
|
2210
|
2345
|
return result
|
|
2211
|
2346
|
}
|