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

Add DeserializeGroup function wrapper

parent de658d61
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!89Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct DeserializeGroup {
public var run: (Data) throws -> Group
public func callAsFunction(_ serializedGroupData: Data) throws -> Group {
try run(serializedGroupData)
}
}
extension DeserializeGroup {
public static func live() -> DeserializeGroup {
DeserializeGroup { serializedGroupData in
var error: NSError?
let bindingsGroup = BindingsDeserializeGroup(serializedGroupData, &error)
if let error = error {
throw error
}
guard let bindingsGroup = bindingsGroup else {
fatalError("BindingsDeserializeGroup returned `nil` without providing error")
}
return .live(bindingsGroup)
}
}
}
extension DeserializeGroup {
public static let unimplemented = DeserializeGroup(
run: XCTUnimplemented("\(Self.self)")
)
}
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