Optional
extension Optional
-
Returns the wrapped value, assuming it exists, leaving this optional empty.
Declaration
Swift
public mutating func release() -> Wrapped -
If
selfisnil, wraps and returnsnewValue; returns the wrapped value otherwise.Declaration
Swift
public mutating func setIfNil( _ newValue: @autoclosure () throws -> Wrapped ) rethrows -> Wrapped -
Evaluates the given closure when this Optional instance is not
nil, passing the unwrapped value as a parameter; returnsdefaultValueotherwise.Declaration
Swift
public func map<U>( default defaultValue: @autoclosure () -> U, _ transform: (Wrapped) -> U ) -> U
View on GitHub