Skip to content

Function

strictMap(_:_:)

Given one or more optionals as inputs, checks whether each input is nil. If any input is nil, nil is immediately returned as an overall results. If all of the inputs have values, the transform callback is invoked with all of the unwrapped values as parameters.
func strictMap<A, Res>(_ a: A?, _ transform: (A) throws -> Res) rethrows -> Res?

Discussion

Note

This “baseline”, single-item version of the function is trivially re-expressible using the ?? operator or Optional.map(_:), but this is not the case for any of the other overloads.

See Also

Optionals