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

Add ResumeBackup functor

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