From e1462a9a87344a0e6a0dbfabe4b73672869723ff Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Mon, 25 Jul 2022 18:38:03 +0100 Subject: [PATCH] Add GetDependencies functor --- Sources/ElixxirDAppsSDK/GetDependencies.swift | 20 +++++++++++++++++++ .../Legacy/DependenciesProvider.swift | 19 ------------------ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 Sources/ElixxirDAppsSDK/GetDependencies.swift delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/DependenciesProvider.swift diff --git a/Sources/ElixxirDAppsSDK/GetDependencies.swift b/Sources/ElixxirDAppsSDK/GetDependencies.swift new file mode 100644 index 00000000..67a80a48 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GetDependencies.swift @@ -0,0 +1,20 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GetDependencies { + public var run: () -> String + + public func callAsFunction() -> String { + run() + } +} + +extension GetDependencies { + public static let live = GetDependencies(run: BindingsGetDependencies) +} + +extension GetDependencies { + public static let unimplemented = GetDependencies( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/Legacy/DependenciesProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/DependenciesProvider.swift deleted file mode 100644 index d9168cd1..00000000 --- a/Sources/ElixxirDAppsSDK/Legacy/DependenciesProvider.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Bindings - -public struct DependenciesProvider { - public var get: () -> String - - public func callAsFunction() -> String { - get() - } -} - -extension DependenciesProvider { - public static let live = DependenciesProvider(get: BindingsGetDependencies) -} - -#if DEBUG -extension DependenciesProvider { - public static let failing = DependenciesProvider { fatalError("Not implemented") } -} -#endif -- GitLab