Organize files

This commit is contained in:
Christoph Hagen 2024-03-20 14:51:46 +01:00
parent ee1993e757
commit 98dffd56e4
28 changed files with 18 additions and 261 deletions

View File

@ -11,7 +11,6 @@
8850025D2B5C273C00E7D4DB /* WorkoutTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8850025C2B5C273C00E7D4DB /* WorkoutTab.swift */; };
8850025F2B5C273E00E7D4DB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8850025E2B5C273E00E7D4DB /* Assets.xcassets */; };
885002622B5C273E00E7D4DB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 885002612B5C273E00E7D4DB /* Preview Assets.xcassets */; };
8850026C2B5C278600E7D4DB /* healthdb_secure.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 8850026B2B5C278600E7D4DB /* healthdb_secure.sqlite */; };
885002772B5C2FC400E7D4DB /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = 885002762B5C2FC400E7D4DB /* SQLite */; };
885002792B5C320400E7D4DB /* Optional+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 885002782B5C320400E7D4DB /* Optional+Extensions.swift */; };
8850028D2B5D0B5000E7D4DB /* WorkoutDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8850028C2B5D0B5000E7D4DB /* WorkoutDetailView.swift */; };
@ -26,7 +25,6 @@
E201EC732B626A30005B83D3 /* WorkoutActivity+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E201EC722B626A30005B83D3 /* WorkoutActivity+Mock.swift */; };
E201EC752B626B19005B83D3 /* Metadata+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E201EC742B626B19005B83D3 /* Metadata+Mock.swift */; };
E20881D32B76912000D41D95 /* HealthKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = E20881D22B76912000D41D95 /* HealthKitExtensions */; };
E20881D52B76944A00D41D95 /* Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = E20881D42B76944A00D41D95 /* Test.swift */; };
E27BC67E2B5E6CE3003A8873 /* Sequence+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC67D2B5E6CE3003A8873 /* Sequence+Extensions.swift */; };
E27BC6802B5E74D7003A8873 /* LocationSampleListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */; };
E27BC6822B5E762D003A8873 /* LocationSampleDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */; };
@ -67,7 +65,6 @@
8850025C2B5C273C00E7D4DB /* WorkoutTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutTab.swift; sourceTree = "<group>"; };
8850025E2B5C273E00E7D4DB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
885002612B5C273E00E7D4DB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
8850026B2B5C278600E7D4DB /* healthdb_secure.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = healthdb_secure.sqlite; sourceTree = "<group>"; };
885002782B5C320400E7D4DB /* Optional+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extensions.swift"; sourceTree = "<group>"; };
8850028C2B5D0B5000E7D4DB /* WorkoutDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutDetailView.swift; sourceTree = "<group>"; };
8850028E2B5D0EAF00E7D4DB /* Date+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Date+Extensions.swift"; sourceTree = "<group>"; };
@ -77,7 +74,6 @@
8850029C2B5D197300E7D4DB /* EventDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventDetailView.swift; sourceTree = "<group>"; };
E201EC722B626A30005B83D3 /* WorkoutActivity+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WorkoutActivity+Mock.swift"; sourceTree = "<group>"; };
E201EC742B626B19005B83D3 /* Metadata+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Metadata+Mock.swift"; sourceTree = "<group>"; };
E20881D42B76944A00D41D95 /* Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Test.swift; sourceTree = "<group>"; };
E27BC67D2B5E6CE3003A8873 /* Sequence+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Extensions.swift"; sourceTree = "<group>"; };
E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSampleListView.swift; sourceTree = "<group>"; };
E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSampleDetailView.swift; sourceTree = "<group>"; };
@ -93,7 +89,7 @@
E2E5528D2BA21C5900BF5E9B /* FileManager+Directory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+Directory.swift"; sourceTree = "<group>"; };
E2E5528F2BA236A000BF5E9B /* DatabaseList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseList.swift; sourceTree = "<group>"; };
E2E552912BA236D000BF5E9B /* DatabaseFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseFile.swift; sourceTree = "<group>"; };
E2E552932BA23B8F00BF5E9B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
E2E552932BA23B8F00BF5E9B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E2E5529A2BA3935600BF5E9B /* HKWorkout+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HKWorkout+Extensions.swift"; sourceTree = "<group>"; };
E2E552A02BA4B14600BF5E9B /* HeartRateSample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeartRateSample.swift; sourceTree = "<group>"; };
E2E552A22BA4B58F00BF5E9B /* HeartRateGraph.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeartRateGraph.swift; sourceTree = "<group>"; };
@ -151,23 +147,15 @@
isa = PBXGroup;
children = (
E2E552932BA23B8F00BF5E9B /* Info.plist */,
E2E5528A2BA21BFB00BF5E9B /* Model */,
E2FDFF342B6E59030080A7B3 /* HealthImport.entitlements */,
8850026A2B5C276B00E7D4DB /* Resources */,
8850025E2B5C273E00E7D4DB /* Assets.xcassets */,
8850025A2B5C273C00E7D4DB /* HealthImportApp.swift */,
E2E552872BA2193B00BF5E9B /* Tabs */,
E2A38EA42B9C6EA900BAD02E /* SearchHealthStoreView.swift */,
8850028C2B5D0B5000E7D4DB /* WorkoutDetailView.swift */,
E2E5529F2BA4B13100BF5E9B /* UI Elements */,
885002922B5D129300E7D4DB /* ActivityDetailView.swift */,
E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */,
E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */,
8850029C2B5D197300E7D4DB /* EventDetailView.swift */,
885002942B5D147100E7D4DB /* DetailRow.swift */,
8850025E2B5C273E00E7D4DB /* Assets.xcassets */,
E2E5528A2BA21BFB00BF5E9B /* Model */,
E2E552BC2BAAE9A900BF5E9B /* Workouts */,
885002602B5C273E00E7D4DB /* Preview Content */,
E20881D42B76944A00D41D95 /* Test.swift */,
885002832B5C37C600E7D4DB /* Support */,
885002832B5C37C600E7D4DB /* Extensions */,
E2A38EA42B9C6EA900BAD02E /* SearchHealthStoreView.swift */,
);
path = HealthImport;
sourceTree = "<group>";
@ -186,15 +174,7 @@
path = "Preview Content";
sourceTree = "<group>";
};
8850026A2B5C276B00E7D4DB /* Resources */ = {
isa = PBXGroup;
children = (
8850026B2B5C278600E7D4DB /* healthdb_secure.sqlite */,
);
path = Resources;
sourceTree = "<group>";
};
885002832B5C37C600E7D4DB /* Support */ = {
885002832B5C37C600E7D4DB /* Extensions */ = {
isa = PBXGroup;
children = (
E27BC6972B5FD76F003A8873 /* Data+Extensions.swift */,
@ -212,7 +192,7 @@
E2E552B62BA9A69400BF5E9B /* Color+Extensions.swift */,
E2E552B82BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift */,
);
path = Support;
path = Extensions;
sourceTree = "<group>";
};
E2E552872BA2193B00BF5E9B /* Tabs */ = {
@ -242,17 +222,23 @@
name = Frameworks;
sourceTree = "<group>";
};
E2E5529F2BA4B13100BF5E9B /* UI Elements */ = {
E2E552BC2BAAE9A900BF5E9B /* Workouts */ = {
isa = PBXGroup;
children = (
E2E552A02BA4B14600BF5E9B /* HeartRateSample.swift */,
885002922B5D129300E7D4DB /* ActivityDetailView.swift */,
885002942B5D147100E7D4DB /* DetailRow.swift */,
8850029C2B5D197300E7D4DB /* EventDetailView.swift */,
E2E552A22BA4B58F00BF5E9B /* HeartRateGraph.swift */,
E2E552A02BA4B14600BF5E9B /* HeartRateSample.swift */,
E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */,
E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */,
E2E552AC2BA98B9B00BF5E9B /* RouteView.swift */,
8850028C2B5D0B5000E7D4DB /* WorkoutDetailView.swift */,
E2E552B42BA9A5D200BF5E9B /* WorkoutListRow.swift */,
E2E552AE2BA98BCF00BF5E9B /* WorkoutMapView.swift */,
E2E552B22BA9A1D500BF5E9B /* WorkoutTypeSelection.swift */,
E2E552B42BA9A5D200BF5E9B /* WorkoutListRow.swift */,
);
path = "UI Elements";
path = Workouts;
sourceTree = "<group>";
};
/* End PBXGroup section */
@ -331,7 +317,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8850026C2B5C278600E7D4DB /* healthdb_secure.sqlite in Resources */,
885002622B5C273E00E7D4DB /* Preview Assets.xcassets in Resources */,
8850025F2B5C273E00E7D4DB /* Assets.xcassets in Resources */,
);
@ -380,7 +365,6 @@
E2E552B32BA9A1D600BF5E9B /* WorkoutTypeSelection.swift in Sources */,
E27BC67E2B5E6CE3003A8873 /* Sequence+Extensions.swift in Sources */,
E2E552AB2BA859A700BF5E9B /* MetadataKey+String.swift in Sources */,
E20881D52B76944A00D41D95 /* Test.swift in Sources */,
E2E552B52BA9A5D200BF5E9B /* WorkoutListRow.swift in Sources */,
E27BC6942B5FD587003A8873 /* Workout+Mock.swift in Sources */,
E2E552AD2BA98B9B00BF5E9B /* RouteView.swift in Sources */,

View File

@ -1,227 +0,0 @@
import Foundation
import HealthKit
import HealthKitExtensions
func insertExamplesOfAllTypes() async throws {
let store = HealthStore()
guard try await requestAllPermissions(in: store) else {
return
}
var startDate = Date(timeIntervalSinceReferenceDate: 700_000_000)
try await insertCategoryTypes(in: store, startDate: &startDate)
try await insertQuantityTypes(in: store, startDate: &startDate)
}
func requestAllPermissions(in store: HealthStore) async throws -> Bool {
let writable: [HKSampleContainer.Type] = HKQuantityType.writableTypes + HKCorrelationType.writableTypes + HKCategoryType.writableTypes
let readable: [HKObjectContainer.Type] = HKQuantityType.readableTypes + HKCorrelationType.readableTypes + HKCategoryType.readableTypes
try await store.requestAuthorization(toShare: writable, read: readable)
var hasAllPermissions = true
writable.forEach {
if store.authorizationStatus(for: $0) != .sharingAuthorized {
print("Missing permission for \($0.objectType)")
hasAllPermissions = false
}
}
return hasAllPermissions
}
private func insertCategoryTypes(in store: HealthStore, startDate: inout Date) async throws {
func make<T>(convert: (Date, Date) -> T) -> T where T: HKObjectContainer {
let result = convert(startDate, startDate.addingTimeInterval(1))
print("\(startDate.timeIntervalSinceReferenceDate): \(T.objectType)")
startDate.addTimeInterval(1)
return result
}
let categorySamples: [HKCategorySampleContainer] = [
make { MindfulSession(start: $0, end: $1) },
make { HandwashingEvent(start: $0, end: $1) },
make { ToothbrushingEvent(start: $0, end: $1) },
make { CervicalMucusQuality(value: .creamy, start: $0, end: $1) },
make { Contraceptive(value: .implant, start: $0, end: $1) },
make { IntermenstrualBleeding(start: $0, end: $1) },
make { Lactation(start: $0, end: $1) },
make { MenstrualFlow(value: .heavy, cycleStart: true, start: $0, end: $1) },
make { OvulationTestResult(value: .negative, start: $0, end: $1) },
make { Pregnancy(start: $0, end: $1) },
make { PregnancyTestResult(value: .positive, start: $0, end: $1) },
make { SexualActivity(protectionUsed: true, start: $0, end: $1) },
make { SleepAnalysis(value: .asleepREM, start: $0, end: $1) },
make { AbdominalCramps(value: .moderate, start: $0, end: $1) },
make { Acne(value: .moderate, start: $0, end: $1) },
make { AppetiteChanges(value: .decreased, start: $0, end: $1) },
make { BladderIncontinence(value: .moderate, start: $0, end: $1) },
make { Bloating(value: .moderate, start: $0, end: $1) },
make { BreastPain(value: .moderate, start: $0, end: $1) },
make { ChestTightnessOrPain(value: .moderate, start: $0, end: $1) },
make { Chills(value: .moderate, start: $0, end: $1) },
make { Constipation(value: .moderate, start: $0, end: $1) },
make { Coughing(value: .moderate, start: $0, end: $1) },
make { Diarrhea(value: .moderate, start: $0, end: $1) },
make { Dizziness(value: .moderate, start: $0, end: $1) },
make { DrySkin(value: .moderate, start: $0, end: $1) },
make { Fainting(value: .moderate, start: $0, end: $1) },
make { Fatigue(value: .moderate, start: $0, end: $1) },
make { Fever(value: .moderate, start: $0, end: $1) },
make { GeneralizedBodyAche(value: .moderate, start: $0, end: $1) },
make { HairLoss(value: .moderate, start: $0, end: $1) },
make { Headache(value: .moderate, start: $0, end: $1) },
make { Heartburn(value: .moderate, start: $0, end: $1) },
make { HotFlashes(value: .moderate, start: $0, end: $1) },
make { LossOfSmell(value: .moderate, start: $0, end: $1) },
make { LossOfTaste(value: .moderate, start: $0, end: $1) },
make { LowerBackPain(value: .moderate, start: $0, end: $1) },
make { MemoryLapse(value: .moderate, start: $0, end: $1) },
make { MoodChanges(value: .present, start: $0, end: $1) },
make { Nausea(value: .moderate, start: $0, end: $1) },
make { NightSweats(value: .moderate, start: $0, end: $1) },
make { PelvicPain(value: .moderate, start: $0, end: $1) },
make { RapidPoundingOrFlutteringHeartbeat(value: .moderate, start: $0, end: $1) },
make { RunnyNose(value: .moderate, start: $0, end: $1) },
make { ShortnessOfBreath(value: .moderate, start: $0, end: $1) },
make { SinusCongestion(value: .moderate, start: $0, end: $1) },
make { SkippedHeartbeat(value: .moderate, start: $0, end: $1) },
make { SleepChanges(value: .present, start: $0, end: $1) },
make { SoreThroat(value: .moderate, start: $0, end: $1) },
make { VaginalDryness(value: .moderate, start: $0, end: $1) },
make { Vomiting(value: .moderate, start: $0, end: $1) },
make { Wheezing(value: .moderate, start: $0, end: $1) },
]
print("Saving...")
try await store.save(categorySamples)
print("Done.")
}
private func insertQuantityTypes(in store: HealthStore, startDate: inout Date) async throws {
func make<T>(convert: (Date, Date) -> T) -> T where T: HKObjectContainer {
let result = convert(startDate, startDate.addingTimeInterval(1))
print("\(startDate.timeIntervalSinceReferenceDate): \(T.objectType)")
startDate.addTimeInterval(1)
return result
}
let samples: [HKQuantitySampleContainer] = [
make { BodyFatPercentage(value: 10.0, start: $0, end: $1) },
make { BodyMass(value: 80.0, start: $0, end: $1) },
make { BodyMassIndex(value: 25.0, start: $0, end: $1) },
make { ElectrodermalActivity(value: 6.0, start: $0, end: $1) },
make { Height(value: 1.80, start: $0, end: $1) },
make { LeanBodyMass(value: 65.0, start: $0, end: $1) },
make { WaistCircumference(value: 1.0, start: $0, end: $1) },
make { ActiveEnergyBurned(value: 1.0, start: $0, end: $1) },
make { BasalEnergyBurned(value: 1.0, start: $0, end: $1) },
//make { CyclingCadence(value: 1.0, start: $0, end: $1) },
//make { CyclingFunctionalThresholdPower(value: 1.0, start: $0, end: $1) },
//make { CyclingPower(value: 1.0, start: $0, end: $1) },
//make { CyclingSpeed(value: 1.0, start: $0, end: $1) },
make { DistanceCycling(value: 1.0, start: $0, end: $1) },
make { DistanceDownhillSnowSports(value: 1.0, start: $0, end: $1) },
make { DistanceSwimming(value: 1.0, start: $0, end: $1) },
make { DistanceWalkingRunning(value: 1.0, start: $0, end: $1) },
make { DistanceWheelchair(value: 1.0, start: $0, end: $1) },
make { FlightsClimbed(value: 1.0, start: $0, end: $1) },
//make { PhysicalEffort(value: 1.0, start: $0, end: $1) },
make { PushCount(value: 1.0, start: $0, end: $1) },
make { RunningPower(value: 1.0, start: $0, end: $1) },
make { RunningSpeed(value: 1.0, start: $0, end: $1) },
make { StepCount(value: 1.0, start: $0, end: $1) },
make { SwimmingStrokeCount(value: 1.0, start: $0, end: $1) },
make { UnderwaterDepth(value: 1.0, start: $0, end: $1) },
make { EnvironmentalAudioExposure(value: 1.0, start: $0, end: $1) },
make { EnvironmentalSoundReduction(value: 1.0, start: $0, end: $1) },
make { HeadphoneAudioExposure(value: 1.0, start: $0, end: $1) },
make { HeartRate(countsPerSecond: 1.0, motionContext: .sedentary, start: $0, end: $1) },
make { HeartRateRecoveryOneMinute(value: 1.0, start: $0, end: $1) },
make { HeartRateVariabilitySDNN(value: 1.0, start: $0, end: $1) },
make { PeripheralPerfusionIndex(value: 1.0, start: $0, end: $1) },
make { RestingHeartRate(value: 1.0, start: $0, end: $1) },
make { Vo2Max(value: 1.0, testType: .maxExercise, start: $0, end: $1) },
make { RunningGroundContactTime(value: 1.0, start: $0, end: $1) },
make { RunningStrideLength(value: 1.0, start: $0, end: $1) },
make { RunningVerticalOscillation(value: 1.0, start: $0, end: $1) },
make { SixMinuteWalkTestDistance(value: 1.0, start: $0, end: $1) },
make { StairAscentSpeed(value: 1.0, start: $0, end: $1) },
make { StairDescentSpeed(value: 1.0, start: $0, end: $1) },
make { WalkingDoubleSupportPercentage(value: 1.0, start: $0, end: $1) },
make { WalkingSpeed(value: 1.0, start: $0, end: $1) },
make { WalkingStepLength(value: 1.0, start: $0, end: $1) },
make { DietaryBiotin(value: 1.0, start: $0, end: $1) },
make { DietaryCaffeine(value: 1.0, start: $0, end: $1) },
make { DietaryCalcium(value: 1.0, start: $0, end: $1) },
make { DietaryCarbohydrates(value: 1.0, start: $0, end: $1) },
make { DietaryChloride(value: 1.0, start: $0, end: $1) },
make { DietaryCholesterol(value: 1.0, start: $0, end: $1) },
make { DietaryChromium(value: 1.0, start: $0, end: $1) },
make { DietaryCopper(value: 1.0, start: $0, end: $1) },
make { DietaryEnergyConsumed(value: 1.0, start: $0, end: $1) },
make { DietaryFatMonounsaturated(value: 1.0, start: $0, end: $1) },
make { DietaryFatPolyunsaturated(value: 1.0, start: $0, end: $1) },
make { DietaryFatSaturated(value: 1.0, start: $0, end: $1) },
make { DietaryFatTotal(value: 1.0, start: $0, end: $1) },
make { DietaryFiber(value: 1.0, start: $0, end: $1) },
make { DietaryFolate(value: 1.0, start: $0, end: $1) },
make { DietaryIodine(value: 1.0, start: $0, end: $1) },
make { DietaryIron(value: 1.0, start: $0, end: $1) },
make { DietaryMagnesium(value: 1.0, start: $0, end: $1) },
make { DietaryManganese(value: 1.0, start: $0, end: $1) },
make { DietaryMolybdenum(value: 1.0, start: $0, end: $1) },
make { DietaryNiacin(value: 1.0, start: $0, end: $1) },
make { DietaryPantothenicAcid(value: 1.0, start: $0, end: $1) },
make { DietaryPhosphorus(value: 1.0, start: $0, end: $1) },
make { DietaryPotassium(value: 1.0, start: $0, end: $1) },
make { DietaryProtein(value: 1.0, start: $0, end: $1) },
make { DietaryRiboflavin(value: 1.0, start: $0, end: $1) },
make { DietarySelenium(value: 1.0, start: $0, end: $1) },
make { DietarySodium(value: 1.0, start: $0, end: $1) },
make { DietarySugar(value: 1.0, start: $0, end: $1) },
make { DietaryThiamin(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminA(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminB6(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminB12(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminC(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminD(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminE(value: 1.0, start: $0, end: $1) },
make { DietaryVitaminK(value: 1.0, start: $0, end: $1) },
make { DietaryWater(value: 1.0, start: $0, end: $1) },
make { DietaryZinc(value: 1.0, start: $0, end: $1) },
make { BloodPressureDiastolic(value: 1.0, start: $0, end: $1) },
make { BloodPressureSystolic(value: 1.0, start: $0, end: $1) },
make { InsulinDelivery(amount: 1.0, reason: .basal, start: $0, end: $1) },
make { NumberOfAlcoholicBeverages(value: 1.0, start: $0, end: $1) },
make { NumberOfTimesFallen(value: 1.0, start: $0, end: $1) },
//make { TimeInDaylight(value: 1.0, start: $0, end: $1) },
make { UvExposure(value: 1.0, start: $0, end: $1) },
make { WaterTemperature(value: 1.0, start: $0, end: $1) },
make { BasalBodyTemperature(value: 1.0, start: $0, end: $1) },
make { ForcedExpiratoryVolume1(value: 1.0, start: $0, end: $1) },
make { ForcedVitalCapacity(value: 1.0, start: $0, end: $1) },
make { InhalerUsage(value: 1.0, start: $0, end: $1) },
make { OxygenSaturation(value: 1.0, start: $0, end: $1) },
make { PeakExpiratoryFlowRate(value: 1.0, start: $0, end: $1) },
make { RespiratoryRate(value: 1.0, start: $0, end: $1) },
make { BloodGlucose(value: 1.0, start: $0, end: $1) },
make { BodyTemperature(value: 1.0, start: $0, end: $1) },
]
let allowed = Set(HKQuantityType.writableTypes.map { $0.quantitySampleType })
samples.forEach {
if !allowed.contains($0.quantitySampleType) {
print("Can't write: \($0.quantitySampleType)")
}
}
print("Saving...")
try await store.save(samples)
print("Done.")
}