ElseContext
public class ElseContext<E, P> where E : Error, P : AsyncBlockPerformer
A construct to build if/else-if/else statements predicated on a Link containing bool
-
Adds an async else clause to an existing .else_if Example usage:
let hb = HoneyBee.start().handlingErrors(with: someErrorHandler)
let testAPassed = testAAsyncFunc(hb) // a Link
let testBPassed = testBAsyncFunc(hb) // a Link if_ (testAPassed) { someAsyncNextStep(hb)(.nextStep) }.else_if (testBPassed) { someSuboptimalStep(hb)(.disappointed) }.else { someAsyncRemediationFunc(hb) } Declaration
Swift
public func `else`(_ action: @escaping () -> Void)
-
Adds an async else if clause to an existing .else_if Example usage:
let hb = HoneyBee.start().handlingErrors(with: someErrorHandler)
let testAPassed = testAAsyncFunc(hb) // a Link
let testBPassed = testBAsyncFunc(hb) // a Link if_ (testAPassed) { someAsyncNextStep(hb)(.nextStep) }.else_if (testBPassed) { someSuboptimalStep(hb)(.disappointed) }.else { someAsyncRemediationFunc(hb) } Declaration
Swift
@discardableResult public func else_if(_ condition: @autoclosure @escaping () -> Link<Bool, E, P>, _ action: @escaping () -> Void) -> ElseContext<E, P>