From a5caf32d316a5b85b6135972507073c873ec4fbe Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Wed, 17 Aug 2022 18:26:09 +0100 Subject: [PATCH] Add IsRegisteredWithUD functor --- .../Functors/IsRegisteredWithUD.swift | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Sources/ElixxirDAppsSDK/Functors/IsRegisteredWithUD.swift diff --git a/Sources/ElixxirDAppsSDK/Functors/IsRegisteredWithUD.swift b/Sources/ElixxirDAppsSDK/Functors/IsRegisteredWithUD.swift new file mode 100644 index 00000000..79097aba --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/IsRegisteredWithUD.swift @@ -0,0 +1,32 @@ +import Bindings +import XCTestDynamicOverlay + +public struct IsRegisteredWithUD { + public var run: (Int) throws -> Bool + + public func callAsFunction(e2eId: Int) throws -> Bool { + try run(e2eId) + } +} + +extension IsRegisteredWithUD { + public static let live = IsRegisteredWithUD { e2eId in + var result: ObjCBool = false + var error: NSError? + BindingsIsRegisteredWithUD( + e2eId, + &result, + &error + ) + if let error = error { + throw error + } + return result.boolValue + } +} + +extension IsRegisteredWithUD { + public static let unimplemented = IsRegisteredWithUD( + run: XCTUnimplemented("\(Self.self)") + ) +} -- GitLab