Future

typealias Future = EventLoopFuture
  • Unwraps an Optional value contained inside a Future’s expectation. If the optional resolves to nil (.none), the supplied error will be thrown instead.

    print(futureString) // Future<String?>
    futureString.unwrap(or: MyError()) // Future<String>
    

    Declaration

    Swift

    public func unwrap(or error: @autoclosure @escaping () -> Error) -> Future<Expectation.WrappedType>

    Parameters

    error

    Error to throw if the value is nil. This is captured with @autoclosure to avoid intiailize the Error unless needed.