From 30cb72659dfe316418e31ff733daf9694fbaece0 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Mon, 25 Jul 2022 18:36:41 +0100 Subject: [PATCH] Add GetIdFromContact functor --- ...dProvider.swift => GetIdFromContact.swift} | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) rename Sources/ElixxirDAppsSDK/{Legacy/ContactIdProvider.swift => GetIdFromContact.swift} (50%) diff --git a/Sources/ElixxirDAppsSDK/Legacy/ContactIdProvider.swift b/Sources/ElixxirDAppsSDK/GetIdFromContact.swift similarity index 50% rename from Sources/ElixxirDAppsSDK/Legacy/ContactIdProvider.swift rename to Sources/ElixxirDAppsSDK/GetIdFromContact.swift index ea291167..da6fc00c 100644 --- a/Sources/ElixxirDAppsSDK/Legacy/ContactIdProvider.swift +++ b/Sources/ElixxirDAppsSDK/GetIdFromContact.swift @@ -1,15 +1,16 @@ import Bindings +import XCTestDynamicOverlay -public struct ContactIdProvider { - public var get: (Data) throws -> Data +public struct GetIdFromContact { + public var run: (Data) throws -> Data public func callAsFunction(contact: Data) throws -> Data { - try get(contact) + try run(contact) } } -extension ContactIdProvider { - public static let live = ContactIdProvider { contact in +extension GetIdFromContact { + public static let live = GetIdFromContact { contact in var error: NSError? let id = BindingsGetIDFromContact(contact, &error) if let error = error { @@ -22,11 +23,8 @@ extension ContactIdProvider { } } -#if DEBUG -extension ContactIdProvider { - public static let failing = ContactIdProvider { _ in - struct NotImplemented: Error {} - throw NotImplemented() - } +extension GetIdFromContact { + public static let unimplemented = GetIdFromContact( + run: XCTUnimplemented("\(Self.self)") + ) } -#endif -- GitLab