diff --git a/HealthImport.xcodeproj/project.pbxproj b/HealthImport.xcodeproj/project.pbxproj index f7b50a4..6048705 100644 --- a/HealthImport.xcodeproj/project.pbxproj +++ b/HealthImport.xcodeproj/project.pbxproj @@ -55,6 +55,7 @@ E2E552B72BA9A69400BF5E9B /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552B62BA9A69400BF5E9B /* Color+Extensions.swift */; }; E2E552B92BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552B82BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift */; }; E2E552BB2BA9CAAE00BF5E9B /* SamplesTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552BA2BA9CAAE00BF5E9B /* SamplesTab.swift */; }; + E2E552C02BAB38DC00BF5E9B /* ActivitySampleList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2E552BF2BAB38DC00BF5E9B /* ActivitySampleList.swift */; }; E2FDFF202B6BE34C0080A7B3 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = E2FDFF1F2B6BE34C0080A7B3 /* SwiftProtobuf */; }; E2FDFF292B6D10D60080A7B3 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FDFF282B6D10D60080A7B3 /* String+Extensions.swift */; }; /* End PBXBuildFile section */ @@ -103,6 +104,7 @@ E2E552B62BA9A69400BF5E9B /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = ""; }; E2E552B82BA9A77D00BF5E9B /* HKWorkoutActivityType+Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HKWorkoutActivityType+Icon.swift"; sourceTree = ""; }; E2E552BA2BA9CAAE00BF5E9B /* SamplesTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SamplesTab.swift; sourceTree = ""; }; + E2E552BF2BAB38DC00BF5E9B /* ActivitySampleList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivitySampleList.swift; sourceTree = ""; }; E2FDFF282B6D10D60080A7B3 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; }; E2FDFF342B6E59030080A7B3 /* HealthImport.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HealthImport.entitlements; sourceTree = ""; }; /* End PBXFileReference section */ @@ -146,16 +148,17 @@ 885002592B5C273C00E7D4DB /* HealthImport */ = { isa = PBXGroup; children = ( - E2E552932BA23B8F00BF5E9B /* Info.plist */, - E2FDFF342B6E59030080A7B3 /* HealthImport.entitlements */, 8850025E2B5C273E00E7D4DB /* Assets.xcassets */, - 8850025A2B5C273C00E7D4DB /* HealthImportApp.swift */, - E2E552872BA2193B00BF5E9B /* Tabs */, - E2E5528A2BA21BFB00BF5E9B /* Model */, - E2E552BC2BAAE9A900BF5E9B /* Workouts */, - 885002602B5C273E00E7D4DB /* Preview Content */, 885002832B5C37C600E7D4DB /* Extensions */, + E2FDFF342B6E59030080A7B3 /* HealthImport.entitlements */, + 8850025A2B5C273C00E7D4DB /* HealthImportApp.swift */, + E2E552932BA23B8F00BF5E9B /* Info.plist */, + E2E5528A2BA21BFB00BF5E9B /* Model */, + 885002602B5C273E00E7D4DB /* Preview Content */, + E2E552BE2BAB38AC00BF5E9B /* Samples */, E2A38EA42B9C6EA900BAD02E /* SearchHealthStoreView.swift */, + E2E552872BA2193B00BF5E9B /* Tabs */, + E2E552BC2BAAE9A900BF5E9B /* Workouts */, ); path = HealthImport; sourceTree = ""; @@ -241,6 +244,14 @@ path = Workouts; sourceTree = ""; }; + E2E552BE2BAB38AC00BF5E9B /* Samples */ = { + isa = PBXGroup; + children = ( + E2E552BF2BAB38DC00BF5E9B /* ActivitySampleList.swift */, + ); + path = Samples; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -346,6 +357,7 @@ E2E552A32BA4B58F00BF5E9B /* HeartRateGraph.swift in Sources */, E2E552AF2BA98BCF00BF5E9B /* WorkoutMapView.swift in Sources */, E2E552BB2BA9CAAE00BF5E9B /* SamplesTab.swift in Sources */, + E2E552C02BAB38DC00BF5E9B /* ActivitySampleList.swift in Sources */, E27BC6962B5FD61D003A8873 /* WorkoutEvent+Mock.swift in Sources */, E2E5529B2BA3935600BF5E9B /* HKWorkout+Extensions.swift in Sources */, E27BC6802B5E74D7003A8873 /* LocationSampleListView.swift in Sources */, @@ -629,7 +641,7 @@ repositoryURL = "https://github.com/christophhagen/HealthDB"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.3.0; + minimumVersion = 0.4.0; }; }; E2FDFF1E2B6BE34C0080A7B3 /* XCRemoteSwiftPackageReference "swift-protobuf" */ = { diff --git a/HealthImport.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/HealthImport.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1144784..f89a4e3 100644 --- a/HealthImport.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/HealthImport.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/christophhagen/HealthDB", "state" : { - "revision" : "6dfcafc66d59bc5887f7bfd66818a169cd7b73dd", - "version" : "0.3.0" + "revision" : "4684ddfa1426a59e1ac7ad7344a75bab1b28d2da", + "version" : "0.4.0" } }, { diff --git a/HealthImport/Samples/ActivitySampleList.swift b/HealthImport/Samples/ActivitySampleList.swift new file mode 100644 index 0000000..7a797bd --- /dev/null +++ b/HealthImport/Samples/ActivitySampleList.swift @@ -0,0 +1,15 @@ +import SwiftUI + +struct ActivitySampleList: View { + + var body: some View { + List { + + } + .navigationTitle("Activity") + } +} + +#Preview { + ActivitySampleList() +} diff --git a/HealthImport/Tabs/SamplesTab.swift b/HealthImport/Tabs/SamplesTab.swift index 0b944b0..e9b1c05 100644 --- a/HealthImport/Tabs/SamplesTab.swift +++ b/HealthImport/Tabs/SamplesTab.swift @@ -8,7 +8,12 @@ struct SamplesTab: View { var body: some View { NavigationStack { List { - Label("Activity", systemSymbol: .flame) + NavigationLink { + ActivitySampleList() + } label: { + Label("Activity", systemSymbol: .flame) + + } Label("Body Measurements", systemSymbol: .figure) Label("Cycle Tracking", systemSymbol: .circleHexagonpath) Label("Hearing", systemSymbol: .ear) diff --git a/HealthImport/Workouts/WorkoutDetailView.swift b/HealthImport/Workouts/WorkoutDetailView.swift index 26f7450..e3fb50d 100644 --- a/HealthImport/Workouts/WorkoutDetailView.swift +++ b/HealthImport/Workouts/WorkoutDetailView.swift @@ -44,7 +44,7 @@ struct WorkoutDetailView: View { private var healthButtonText = "Checking for workout in Health..." private var metadataFields: [(key: String, value: Any)] { - workout.metadata.sorted { $0.key } + workout.metadata?.sorted { $0.key } ?? [] } private var averageHeartRate: Int { @@ -109,7 +109,7 @@ struct WorkoutDetailView: View { DetailRow(MetadataKeyName(key), value: "\(value)") } } label: { - DetailRow("Metadata", value: workout.metadata.count) + DetailRow("Metadata", value: workout.metadata?.count ?? 0) } DisclosureGroup { ForEach(privateMetadata, id:\.key) { (key, value) in diff --git a/HealthImport/Workouts/WorkoutListRow.swift b/HealthImport/Workouts/WorkoutListRow.swift index dfb9c34..ad2597a 100644 --- a/HealthImport/Workouts/WorkoutListRow.swift +++ b/HealthImport/Workouts/WorkoutListRow.swift @@ -9,7 +9,7 @@ struct WorkoutListRow: View { let workout: Workout var indoor: Bool { - guard let isIndoor: Bool = workout.metadata[.indoorWorkout] else { + guard let isIndoor: Bool = workout.metadata?.indoorWorkout else { return false } return isIndoor @@ -17,7 +17,7 @@ struct WorkoutListRow: View { var type: HKWorkoutActivityType { if #available(iOS 17.0, *) { - if let type: HKWorkoutActivityType = workout.metadata.activityType { + if let type: HKWorkoutActivityType = workout.metadata?.activityType { return type } }