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

Add InitializeBackup functor

parent 9de84b1d
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct InitializeBackup {
public var run: (Int, Int, String, UpdateBackupFunc) throws -> Backup
public func callAsFunction(
e2eId: Int,
udId: Int,
password: String,
callback: UpdateBackupFunc
) throws -> Backup {
try run(e2eId, udId, password, callback)
}
}
extension InitializeBackup {
public static let live = InitializeBackup { e2eId, udId, password, callback in
var error: NSError?
let bindingsBackup = BindingsInitializeBackup(
e2eId,
udId,
password,
callback.makeBindingsUpdateBackupFunc(),
&error
)
if let error = error {
throw error
}
guard let bindingsBackup = bindingsBackup else {
fatalError("BindingsInitializeBackup returned `nil` without providing error")
}
return .live(bindingsBackup)
}
}
extension InitializeBackup {
public static let unimplemented = InitializeBackup(
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