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

Add LoadCmix functor

parent a109e922
No related branches found
No related tags found
Loading
import Bindings
import XCTestDynamicOverlay
public struct LoadCmix {
public var run: (String, Data, Data) throws -> Cmix
public func callAsFunction(
storageDir: String,
password: Data,
cmixParamsJSON: Data
) throws -> Cmix {
try run(storageDir, password, cmixParamsJSON)
}
}
extension LoadCmix {
public static let live = LoadCmix { storageDir, password, cmixParamsJSON in
var error: NSError?
let bindingsCmix = BindingsLoadCmix(storageDir, password, cmixParamsJSON, &error)
if let error = error {
throw error
}
guard let bindingsCmix = bindingsCmix else {
fatalError("BindingsLoadCmix returned `nil` without providing error")
}
return Cmix.live(bindingsCmix)
}
}
extension LoadCmix {
public static let unimplemented = LoadCmix(
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