From e5a541206af7858b432074c656712db78d752af7 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Fri, 12 Sep 2025 01:11:43 +0200 Subject: [PATCH] Improved the initializer function for the AmiiboService service type in the library target to use a AmiiboLiveClient client type as a default value. --- .../AmiiboService/Public/Services/AmiiboService.swift | 11 ++++------- .../Public/Services/AmiiboServiceLiveTests.swift | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Sources/AmiiboService/Public/Services/AmiiboService.swift b/Sources/AmiiboService/Public/Services/AmiiboService.swift index fdb947f..51e9bd1 100644 --- a/Sources/AmiiboService/Public/Services/AmiiboService.swift +++ b/Sources/AmiiboService/Public/Services/AmiiboService.swift @@ -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 diff --git a/Tests/AmiiboService/Tests/Public/Services/AmiiboServiceLiveTests.swift b/Tests/AmiiboService/Tests/Public/Services/AmiiboServiceLiveTests.swift index 908c379..536f87d 100644 --- a/Tests/AmiiboService/Tests/Public/Services/AmiiboServiceLiveTests.swift +++ b/Tests/AmiiboService/Tests/Public/Services/AmiiboServiceLiveTests.swift @@ -24,7 +24,7 @@ struct AmiiboServiceLiveTests { // MARK: Initializers init() { - self.service = .init(.live()) + self.service = .init() } // MARK: Functions tests