Optional

enum Optional<T>
Inheritance DebugPrintable, NilLiteralConvertible, Reflectable View Protocol Hierarchy →
Import import Swift

Cases

Initializers

init()

Construct a nil instance.

Declaration

init()
init(_:)

Construct a non-nil instance that stores some.

Declaration

init(_ some: T)
init(nilLiteral:)

Create an instance initialized with nil.

Declaration

init(nilLiteral: ())

Instance Variables

var debugDescription: String

A textual representation of self, suitable for debugging.

Declaration

var debugDescription: String { get }

Instance Methods

func flatMap(_:)

Returns f(self)! iff self and f(self) are not nil.

Declaration

func flatMap<U>(f: @noescape (T) -> U?) -> U?
func getMirror()

Returns a mirror that reflects self.

Declaration

func getMirror() -> MirrorType
func map(_:)

If self == nil, returns nil. Otherwise, returns f(self!).

Declaration

func map<U>(f: @noescape (T) -> U) -> U?