Skip to content

Commit

Permalink
use DependencyClient macro
Browse files Browse the repository at this point in the history
  • Loading branch information
ski-u committed Sep 28, 2024
1 parent 55e2e4e commit 92fb107
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions Features/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let package = Package(
dependencies: [
"Models",
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "DependenciesMacros", package: "swift-dependencies"),
]
),
.target(
Expand Down
10 changes: 3 additions & 7 deletions Features/Sources/APIClient/APIClient.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 92fb107

Please sign in to comment.