From 92fb1071bfec02c3d1363dac2ae36e11a950a733 Mon Sep 17 00:00:00 2001 From: Yunosuke Sakai Date: Sat, 28 Sep 2024 13:48:41 +0900 Subject: [PATCH] use `DependencyClient` macro --- Features/Package.swift | 1 + Features/Sources/APIClient/APIClient.swift | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Features/Package.swift b/Features/Package.swift index 6ff5aec..fa2151e 100644 --- a/Features/Package.swift +++ b/Features/Package.swift @@ -38,6 +38,7 @@ let package = Package( dependencies: [ "Models", .product(name: "Dependencies", package: "swift-dependencies"), + .product(name: "DependenciesMacros", package: "swift-dependencies"), ] ), .target( diff --git a/Features/Sources/APIClient/APIClient.swift b/Features/Sources/APIClient/APIClient.swift index b2b4d69..3bac6de 100644 --- a/Features/Sources/APIClient/APIClient.swift +++ b/Features/Sources/APIClient/APIClient.swift @@ -1,16 +1,12 @@ import Dependencies +import DependenciesMacros import Foundation import Models import XCTestDynamicOverlay -public struct APIClient: Sendable { +@DependencyClient +public struct APIClient { public var apod: @Sendable () async throws -> AstronomyPicture - - public init( - apod: @escaping @Sendable () async throws -> AstronomyPicture - ) { - self.apod = apod - } } extension APIClient: TestDependencyKey {