From 7e66f81aa6ae4fb798ce69c18be657f858675fb1 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Wed, 20 Mar 2024 14:47:42 +0100 Subject: [PATCH] Remove unused views --- HealthImport.xcodeproj/project.pbxproj | 8 --- HealthImport/ActivitySamplesView.swift | 71 -------------------------- HealthImport/SampleListView.swift | 30 ----------- 3 files changed, 109 deletions(-) delete mode 100644 HealthImport/ActivitySamplesView.swift delete mode 100644 HealthImport/SampleListView.swift diff --git a/HealthImport.xcodeproj/project.pbxproj b/HealthImport.xcodeproj/project.pbxproj index 7c2bcaf..f79252f 100644 --- a/HealthImport.xcodeproj/project.pbxproj +++ b/HealthImport.xcodeproj/project.pbxproj @@ -25,14 +25,12 @@ 885002AA2B5D296700E7D4DB /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 885002A92B5D296700E7D4DB /* OrderedCollections */; }; 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 */; }; - E201EC7F2B629B4C005B83D3 /* SampleListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E201EC7E2B629B4C005B83D3 /* SampleListView.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 */; }; E27BC6842B5E76A4003A8873 /* Location+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC6832B5E76A4003A8873 /* Location+Mock.swift */; }; - E27BC68C2B5FC842003A8873 /* ActivitySamplesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC68B2B5FC842003A8873 /* ActivitySamplesView.swift */; }; E27BC6922B5FD488003A8873 /* HealthDatabase+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC6912B5FD488003A8873 /* HealthDatabase+Mock.swift */; }; E27BC6942B5FD587003A8873 /* Workout+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC6932B5FD587003A8873 /* Workout+Mock.swift */; }; E27BC6962B5FD61D003A8873 /* WorkoutEvent+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27BC6952B5FD61D003A8873 /* WorkoutEvent+Mock.swift */; }; @@ -79,13 +77,11 @@ 8850029C2B5D197300E7D4DB /* EventDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventDetailView.swift; sourceTree = ""; }; E201EC722B626A30005B83D3 /* WorkoutActivity+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WorkoutActivity+Mock.swift"; sourceTree = ""; }; E201EC742B626B19005B83D3 /* Metadata+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Metadata+Mock.swift"; sourceTree = ""; }; - E201EC7E2B629B4C005B83D3 /* SampleListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleListView.swift; sourceTree = ""; }; E20881D42B76944A00D41D95 /* Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Test.swift; sourceTree = ""; }; E27BC67D2B5E6CE3003A8873 /* Sequence+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Extensions.swift"; sourceTree = ""; }; E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSampleListView.swift; sourceTree = ""; }; E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSampleDetailView.swift; sourceTree = ""; }; E27BC6832B5E76A4003A8873 /* Location+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Location+Mock.swift"; sourceTree = ""; }; - E27BC68B2B5FC842003A8873 /* ActivitySamplesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivitySamplesView.swift; sourceTree = ""; }; E27BC6912B5FD488003A8873 /* HealthDatabase+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HealthDatabase+Mock.swift"; sourceTree = ""; }; E27BC6932B5FD587003A8873 /* Workout+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workout+Mock.swift"; sourceTree = ""; }; E27BC6952B5FD61D003A8873 /* WorkoutEvent+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WorkoutEvent+Mock.swift"; sourceTree = ""; }; @@ -164,8 +160,6 @@ 8850028C2B5D0B5000E7D4DB /* WorkoutDetailView.swift */, E2E5529F2BA4B13100BF5E9B /* UI Elements */, 885002922B5D129300E7D4DB /* ActivityDetailView.swift */, - E27BC68B2B5FC842003A8873 /* ActivitySamplesView.swift */, - E201EC7E2B629B4C005B83D3 /* SampleListView.swift */, E27BC67F2B5E74D7003A8873 /* LocationSampleListView.swift */, E27BC6812B5E762D003A8873 /* LocationSampleDetailView.swift */, 8850029C2B5D197300E7D4DB /* EventDetailView.swift */, @@ -350,7 +344,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - E201EC7F2B629B4C005B83D3 /* SampleListView.swift in Sources */, E2A38EA32B9A024500BAD02E /* Workout+Extensions.swift in Sources */, E2E552922BA236D000BF5E9B /* DatabaseFile.swift in Sources */, E27BC6982B5FD76F003A8873 /* Data+Extensions.swift in Sources */, @@ -388,7 +381,6 @@ E27BC67E2B5E6CE3003A8873 /* Sequence+Extensions.swift in Sources */, E2E552AB2BA859A700BF5E9B /* MetadataKey+String.swift in Sources */, E20881D52B76944A00D41D95 /* Test.swift in Sources */, - E27BC68C2B5FC842003A8873 /* ActivitySamplesView.swift in Sources */, E2E552B52BA9A5D200BF5E9B /* WorkoutListRow.swift in Sources */, E27BC6942B5FD587003A8873 /* Workout+Mock.swift in Sources */, E2E552AD2BA98B9B00BF5E9B /* RouteView.swift in Sources */, diff --git a/HealthImport/ActivitySamplesView.swift b/HealthImport/ActivitySamplesView.swift deleted file mode 100644 index cc1f2a7..0000000 --- a/HealthImport/ActivitySamplesView.swift +++ /dev/null @@ -1,71 +0,0 @@ -import SwiftUI -import OrderedCollections -import HealthKit -import HealthDB - -struct ActivitySamplesView: View { - - let activity: HKWorkoutActivity - - @State var samples: [(type: HKSampleType, samples: [HKSample])] = [] - - @State var timeZones: [TimeZone] = [] - - init(activity: HKWorkoutActivity) { - self.activity = activity - } - - var body: some View { - List { - if !timeZones.isEmpty { - Section("Time Zones") { - ForEach(timeZones, id: \.identifier) { timeZone in - Text(timeZone.debugDescription) - } - } - } - Section("Samples") { - ForEach(samples, id: \.0) { entry in - NavigationLink { - SampleListView(type: entry.type, samples: entry.samples) - } label: { - DetailRow(entry.type.description, value: entry.samples.count) - } - } - } - }.onAppear(perform: load) - } - - private func load() { - Task { - self.loadAsync() - } - } - - private func loadAsync() { - #warning("Load samples for activity") - /* - do { - let samples = try HealthDatabase.shared.samples(for: activity) - let ordered = samples - .sorted(using: { $0.key.rawValue }) - .map { (type: $0, samples: $1) } - let timeZones: Set = samples.reduce(into: Set()) { timeZones, sample in - timeZones.formUnion(sample.compactMap { $0.timeZone }) - } - - DispatchQueue.main.async { - self.samples = ordered - self.timeZones = timeZones.sorted { $0.identifier } - } - - } catch { - print("Failed to load samples: \(error)") - } - */ - } -} - -#Preview { - ActivitySamplesView(activity: .mock1) -} diff --git a/HealthImport/SampleListView.swift b/HealthImport/SampleListView.swift deleted file mode 100644 index 4293de8..0000000 --- a/HealthImport/SampleListView.swift +++ /dev/null @@ -1,30 +0,0 @@ -import SwiftUI -import HealthKit - -struct SampleListView: View { - - let type: HKSampleType - - let samples: [HKSample] - - var body: some View { - List { - ForEach(samples) { sample in - DetailRow("", value: sample) - } - } - .navigationTitle(type.description) - } -} -/* -#Preview { - SampleListView() -} -*/ - -extension HKSample: Identifiable { - - public var id: UUID { - uuid - } -}