Optional (ext)
You’re viewing third-party extensions to Optional
, an enum from the Swift standard library.
You can also read the documentation forOptional
itself.
extension Optional
You’re viewing third-party extensions to Optional
, an enum from the Swift standard library.
You can also read the documentation forOptional
itself.
extension Optional
@frozen enum Optional<Wrapped> where Wrapped : ~Copyable
A type that represents either a wrapped value or the absence of a value.
import CasePathsCore
Case paths bring the power and ergonomics of key paths to enums.
static var allCasePaths: AllCasePaths { get }
@dynamicMemberLookup struct AllCasePaths
subscript<Value>(case keyPath: CaseKeyPath<Self, Value>) -> Value? { get }
Attempts to extract the associated value from a root enum using a case key path.
subscript<Value>(case keyPath: CaseKeyPath<Self, Value>) -> Value { get set }
Replaces the associated value of a root enum at a case key path when the case matches.
subscript(case keyPath: PartialCaseKeyPath<Self>) -> Any? { get }
Attempts to extract the associated value from a root enum using a partial case key path.
subscript<Value>(dynamicMember keyPath: KeyPath<Self.AllCasePaths, AnyCasePath<Self, Value>>) -> Value? { get set }
Extracts the associated value of a case via dynamic member lookup.
subscript<Value>(dynamicMember keyPath: KeyPath<Self.AllCasePaths, AnyCasePath<Self, Value>>) -> Value { get set }
Embeds the associated value of a case via dynamic member lookup.
func `is`(_ keyPath: PartialCaseKeyPath<Self>) -> Bool
Tests the associated value of a case.
mutating func modify<Value>(_ keyPath: CaseKeyPath<Self, Value>, yield: (inout Value) -> Void, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column)
Unwraps and yields a mutable associated value to a closure.
typealias Cases = Case<Self>
A namespace that can be used to derive case key paths from case-pathable enums.
protocol CasePathable
A type that provides a collection of all of its case paths.
func `is`(_ keyPath: PartialCaseKeyPath<Wrapped>) -> Bool
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable
protocol CasePathIterable : CasePathable where Self.AllCasePaths : Sequence, Self.AllCasePaths.Element == PartialKeyPath<Case<Self>>
A type that provides a collection of all of its case paths.