Remove unused views
This commit is contained in:
@@ -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<TimeZone> = 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)
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user