optionally(_:)

public func optionally<X>(_ defineBlock: @escaping (Link<B.WrappedType>) -> Link<X>) -> Link<B>

When B is an Optional you may call optionally. The supplied define block creates a subchain which will be run if the Optional value is non-nil. The Link given to the define block yields a non-optional value of B.WrappedType to its child links This function returns a Link with a void result value, because the subchain defined by optionally will not be executed if B is nil.

  • X

    Declaration

    Swift

    public func optionally<X>(_ defineBlock: @escaping (Link<B.WrappedType>) -> Link<X>) -> Link<B>