Optional
extension Optional: CustomStringConvertible
extension Optional: OptionalType
public extension Optional where Wrapped: Collection
public extension Optional where Wrapped == String
public extension Optional where Wrapped == Data
public extension Optional where Wrapped: Occupiable
public extension Optional where Wrapped: Collection & Occupiable
public extension Optional where Wrapped: InitializeableOccupiable
-
Declaration
Swift
public var description: String { get }
-
Cast
Optional<Wrapped>
toWrapped?
Declaration
Swift
public var value: Wrapped? { get }
-
Check if object is nil or empty
Declaration
Swift
var isNilOrEmpty: Bool { get }
-
Check if object is nil or empty
Declaration
Swift
var isNilOrEmpty: Bool { get }
-
Check if object is nil or empty
Declaration
Swift
var isNilOrEmpty: Bool { get }
-
true
if current occupiable optional is either nil or empty,false
otherwise.Declaration
Swift
var isNilOrEmpty: Bool { get }
-
true
if current occupiable optional represents some non-empty value.Declaration
Swift
var isNotEmpty: Bool { get }
-
Unwraps optional and replaces empty value by
nil
.Declaration
Swift
var nonEmpty: Wrapped? { get }
-
Property equal to
isNotEmpty
property. Added just because in the case of Collection types, ‘hasElements’ is more descriptive name than ‘isNotEmpty’.Declaration
Swift
var hasElements: Bool { get }
-
Unwraps optional and replaces
nil
value by empty value.Declaration
Swift
var nonNil: Wrapped { get }