32 lines
654 B
Swift
32 lines
654 B
Swift
//
|
|
// ClientFactory.swift
|
|
// Meow
|
|
//
|
|
|
|
import Foundation
|
|
import CatFactsKit
|
|
import ComposableArchitecture
|
|
|
|
public struct ClientFactory: Sendable {
|
|
public func createClient(baseURL: URL) -> CatFacts {
|
|
return CatFacts(baseURL: baseURL)
|
|
}
|
|
}
|
|
|
|
extension ClientFactory: DependencyKey, TestDependencyKey {
|
|
public static var liveValue: ClientFactory {
|
|
ClientFactory()
|
|
}
|
|
|
|
public static var testValue: ClientFactory {
|
|
ClientFactory()
|
|
}
|
|
}
|
|
|
|
public extension DependencyValues {
|
|
var clientFactory: ClientFactory {
|
|
get { self[ClientFactory.self] }
|
|
set { self[ClientFactory.self] = newValue }
|
|
}
|
|
}
|