diff --git a/Package.swift b/Package.swift index dd7f5b1..155f028 100644 --- a/Package.swift +++ b/Package.swift @@ -19,12 +19,12 @@ let package = Package( .iOS(.v17) ], products: [ - .library(name: "SpeziHealthKit", targets: ["SpeziHealthKit"]), - .library(name: "SpeziHealthKitUI", targets: ["SpeziHealthKitUI"]) + .library(name: "SpeziHealthKit", targets: ["SpeziHealthKit"]) ], dependencies: [ .package(path: "../Spezi"), - .package(path: "../SpeziFoundation") + .package(path: "../SpeziFoundation"), + .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.7") ] + swiftLintPackage(), targets: [ .target( @@ -35,20 +35,12 @@ let package = Package( ], plugins: [] + swiftLintPlugin() ), - .target( - name: "SpeziHealthKitUI", - dependencies: [ - .target(name: "SpeziHealthKit"), - .product(name: "Spezi", package: "Spezi"), - .product(name: "SpeziFoundation", package: "SpeziFoundation") - ], - plugins: [] + swiftLintPlugin() - ), .testTarget( name: "SpeziHealthKitTests", dependencies: [ .product(name: "XCTSpezi", package: "Spezi"), - .target(name: "SpeziHealthKit") + .target(name: "SpeziHealthKit"), + .product(name: "SnapshotTesting", package: "swift-snapshot-testing") ], plugins: [] + swiftLintPlugin() ) diff --git a/Sources/SpeziHealthKitUI/HealthChart/HealthChart.swift b/Sources/SpeziHealthKit/HealthChart/HealthChart.swift similarity index 100% rename from Sources/SpeziHealthKitUI/HealthChart/HealthChart.swift rename to Sources/SpeziHealthKit/HealthChart/HealthChart.swift diff --git a/Sources/SpeziHealthKitUI/HealthChart/HealthChartContentBuilder.swift b/Sources/SpeziHealthKit/HealthChart/HealthChartContentBuilder.swift similarity index 100% rename from Sources/SpeziHealthKitUI/HealthChart/HealthChartContentBuilder.swift rename to Sources/SpeziHealthKit/HealthChart/HealthChartContentBuilder.swift diff --git a/Sources/SpeziHealthKitUI/HealthChart/HealthChartEntry.swift b/Sources/SpeziHealthKit/HealthChart/HealthChartEntry.swift similarity index 97% rename from Sources/SpeziHealthKitUI/HealthChart/HealthChartEntry.swift rename to Sources/SpeziHealthKit/HealthChart/HealthChartEntry.swift index 8842d5f..ef089c1 100644 --- a/Sources/SpeziHealthKitUI/HealthChart/HealthChartEntry.swift +++ b/Sources/SpeziHealthKit/HealthChart/HealthChartEntry.swift @@ -16,10 +16,10 @@ import SpeziHealthKit // TODO Rename HealthChartDateSet? (Entry kinda sounds like it's referring to a single data point. But then again, it could very well also be the case that we want to split eg "step count" up into separate data sets, to make it look nicer? /// An entry in a ``HealthChart`` public final class HealthChartEntry: Sendable { - public typealias HealthKitQueryDataPoint = SpeziHealthKitUI.HealthKitQueryDataPoint// +// public typealias HealthKitQueryDataPoint = SpeziHealthKit.HealthKitQueryDataPoint// public typealias MakeDataPointImp = @Sendable (Results.Element, Results) -> HealthKitQueryDataPoint? - private enum Variant { + private enum Variant: Sendable { case regular(Results, HealthChartDrawingConfig, MakeDataPointImp) case empty } diff --git a/Sources/SpeziHealthKitUI/HealthOverview.swift b/Sources/SpeziHealthKitUI/HealthOverview.swift deleted file mode 100644 index 9e514ad..0000000 --- a/Sources/SpeziHealthKitUI/HealthOverview.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// This source file is part of the Stanford Spezi open-source project -// -// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) -// -// SPDX-License-Identifier: MIT -// - -import Foundation -import SpeziHealthKit -import SwiftUI - - - -// TODO implement or remove! -public struct HealthOverview: View { - private let component: (repeat HealthOverviewComponent) - - public init(_ component: repeat HealthOverviewComponent) { - self.component = (repeat each component) - } - - public var body: some View { - Text("coming soon ;)") - } -} - - - - -public final class HealthOverviewComponent { -// public enum Config { -// case mostRecentSample -// case chart(HealthChartDrawingConfig) -// } - - private enum Config { - case mostRecentSample - case chart(HealthChartDrawingConfig) - } - - private let results: Results - private let config: Config - - private init(results: Results, config: Config) { - self.results = results - self.config = config - } - - public static func mostRecentValue(_ results: Results) -> Self where Results.Element == HKQuantitySample { - Self.init(results: results, config: .mostRecentSample) - } - - public static func chart(_ results: Results, config drawingConfig: HealthChartDrawingConfig) -> Self where Results.Element == HKStatistics { - Self.init(results: results, config: .chart(drawingConfig)) - } -} -