The Optional aspect can be applied to a member of an interface on the Cocoa platform to make it optional, meaning that classes implementing the interface will not need to provide an implementation. Callers working with an interface reference will need to check using the Cocoa respondsToSelector API whether an optional member is supported.

The aspect is mostly used for C# and Java. In both Oxygene and Swift, the optional keyword can be used to express the same notion.

Cocoa Only

The Optional aspect (and optional interface members in general) are available on the Cocoa platform only.

Defined by the core compiler.

See Also