OptionalKeyPath
public struct OptionalKeyPath
OptionalKeyPath represents the path to a specific node in a tree of nested dictionaries.
Can be created from string and array literals and can be joined by the =>? operator.
let a: OptionalKeyPath = "a"
let b: OptionalKeyPath = ["a", "b"]
let c: OptionalKeyPath = "a" =>? "b" =>? "c"
Unlike KeyPath, OptionalKeyPath allows each key to be either required or optional.
isRequired is false by default.
When a KeyPath is converted to a OptionalKeyPath, isRequired is set to true.
let c: OptionalKeyPath = "a" =>? "b" => "c"
^^
isRequired=true
In the above example "c" is inferred as KeyPath, then converted to OptionalKeyPath
with isRequired = true
-
Undocumented
Declaration
Swift
public var keys: [OptionalKey]
-
Declaration
Swift
public init(stringLiteral value: String) -
Declaration
Swift
public init(extendedGraphemeClusterLiteral value: String) -
Declaration
Swift
public init(unicodeScalarLiteral value: String)
-
Declaration
Swift
public init(arrayLiteral elements: String...)
OptionalKeyPath Structure Reference