Skip to content
Snippets Groups Projects
Commit 30cb7265 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add GetIdFromContact functor

parent 10b788a1
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment