Optional
public extension Optional
public extension Optional where Wrapped: EmptyValueRepresentable
public extension Optional where Wrapped: Emptyable
-
Returns whether the receiver is
nil
.Declaration
Swift
var isNil: Bool { get }
-
Returns whether the receiver is NOT
nil
.Declaration
Swift
var isNotNil: Bool { get }
-
Returns the wrapped value or the
EmptyValueRepresentable.emptyValue
if the receiver is nil.let value: String? = nil let retval = value.valueOrEmpty // do something with retval which is ""
Declaration
Swift
var valueOrEmpty: Wrapped { get }
-
Returns whether the receiver is empty or nil.
Declaration
Swift
var isEmptyOrNil: Bool { get }
-
Returns whether the receiver is NOT empty or nil.
Declaration
Swift
var isNotEmptyOrNil: Bool { get }