Constructor
public final class Constructor
Constructors are used to translate Node
s to Swift values.
-
Maps
Tag.Name
s toNode.Scalar
s. -
Maps
Tag.Name
s toNode.Mapping
s. -
Maps
Tag.Name
s toNode.Sequence
s. -
Initialize a
Constructor
with the specified maps, falling back to default maps.Declaration
Swift
public init(_ scalarMap: ScalarMap = defaultScalarMap, _ mappingMap: MappingMap = defaultMappingMap, _ sequenceMap: SequenceMap = defaultSequenceMap)
Parameters
scalarMap
Maps
Tag.Name
s toNode.Scalar
s.mappingMap
Maps
Tag.Name
s toNode.Mapping
s.sequenceMap
Maps
Tag.Name
s toNode.Sequence
s. -
Constructs Swift values based on the maps this
Constructor
was initialized with.Declaration
Swift
public func any(from node: Node) -> Any
Parameters
node
Node
from which to extract anAny
Swift value, if one was produced by the Node type’s relevant mapping on thisConstructor
.Return Value
An
Any
Swift value, if one was produced by the Node type’s relevant mapping on thisConstructor
.
-
The default
Constructor
to be used with APIs where none is explicitly provided.Declaration
Swift
public static let `default`: Constructor
-
The default
Tag.Name
toNode.Scalar
map.Declaration
Swift
public static let defaultScalarMap: ScalarMap
-
The default
Tag.Name
toNode.Mapping
map.Declaration
Swift
public static let defaultMappingMap: MappingMap
-
The default
Tag.Name
toNode.Sequence
map.Declaration
Swift
public static let defaultSequenceMap: SequenceMap