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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user