Improved the initializer function for the AmiiboService service type in the library target to use a AmiiboLiveClient client type as a default value.

This commit is contained in:
2025-09-12 01:11:43 +02:00
parent 6f3249833a
commit e5a541206a
2 changed files with 5 additions and 8 deletions
@@ -18,17 +18,14 @@ public struct AmiiboService {
// MARK: Properties
/// A client to interact with the endpoints.
private let client: any APIClient
private let client: any AmiiboClient
// MARK: Initializers
/// Initializes this service with a specific client type.
/// - Parameter client: A representation of a client to use to interact with the endpoints.
public init(_ client: AmiiboClient) {
self.client = switch client {
case let .mock(mockClient): mockClient
case let .live(liveClient): liveClient
}
/// - Parameter client: A client to use to interact with the endpoints.
public init(client: some AmiiboClient = AmiiboLiveClient()) {
self.client = client
}
// MARK: Functions
@@ -24,7 +24,7 @@ struct AmiiboServiceLiveTests {
// MARK: Initializers
init() {
self.service = .init(.live())
self.service = .init()
}
// MARK: Functions tests