Node
public enum Node : Hashable
extension Node: Comparable
extension Node: ExpressibleByArrayLiteral
extension Node: ExpressibleByDictionaryLiteral
extension Node: ExpressibleByFloatLiteral
extension Node: ExpressibleByIntegerLiteral
extension Node: ExpressibleByStringLiteral
extension Node: NodeRepresentable
YAML Node.
-
Scalar node.
Declaration
Swift
case scalar(Scalar)
-
Mapping node.
Declaration
Swift
case mapping(Mapping)
-
Sequence node.
Declaration
Swift
case sequence(Sequence)
-
A mapping is the YAML equivalent of a
See moreDictionary
.Declaration
-
Get or set the
Node.Mapping
value if this node is aNode.mapping
.Declaration
Swift
public var mapping: Mapping? { get set }
-
Scalar node.
See moreDeclaration
-
Get or set the
Node.Scalar
value if this node is aNode.scalar
.Declaration
Swift
public var scalar: Scalar? { get set }
-
Sequence node.
See moreDeclaration
Swift
public struct Sequence
extension Node.Sequence: Comparable
extension Node.Sequence: Equatable
extension Node.Sequence: Hashable
extension Node.Sequence: ExpressibleByArrayLiteral
extension Node.Sequence: MutableCollection
extension Node.Sequence: RandomAccessCollection
extension Node.Sequence: RangeReplaceableCollection
-
Get or set the
Node.Sequence
value if this node is aNode.sequence
.Declaration
Swift
public var sequence: Sequence? { get set }
-
Create a
Node.scalar
with a string, tag & scalar style.Declaration
Parameters
string
String value for this node.
tag
Tag for this node.
style
Style to use when emitting this node.
-
Create a
Node.mapping
with a sequence of node pairs, tag & scalar style.Declaration
Parameters
pairs
Pairs of nodes to use for this node.
tag
Tag for this node.
style
Style to use when emitting this node.
-
Create a
Node.sequence
with a sequence of nodes, tag & scalar style.Declaration
Parameters
nodes
Sequence of nodes to use for this node.
tag
Tag for this node.
style
Style to use when emitting this node.
-
This node as an
Any
, if convertible.Declaration
Swift
public var any: Any { get }
-
This node as a
String
, if convertible.Declaration
Swift
public var string: String? { get }
-
This node as a
Bool
, if convertible.Declaration
Swift
public var bool: Bool? { get }
-
This node as a
Double
, if convertible.Declaration
Swift
public var float: Double? { get }
-
This node as an
NSNull
, if convertible.Declaration
Swift
public var null: NSNull? { get }
-
This node as an
Int
, if convertible.Declaration
Swift
public var int: Int? { get }
-
This node as a
Data
, if convertible.Declaration
Swift
public var binary: Data? { get }
-
This node as a
Date
, if convertible.Declaration
Swift
public var timestamp: Date? { get }
-
This node as a
UUID
, if convertible.Declaration
Swift
public var uuid: UUID? { get }
-
Returns this node mapped as an
Array<Node>
. If the node isn’t aNode.sequence
, the array will be empty.Declaration
Swift
public func array() -> [Node]
-
Typed Array using type parameter: e.g.
array(of: String.self)
.Declaration
Swift
public func array<Type>(of type: Type.Type = Type.self) -> [Type] where Type : ScalarConstructible
Parameters
type
Type conforming to
ScalarConstructible
.Return Value
Array of
Type
. -
If the node is a
.sequence
or.mapping
, set or get the specified parameter’sNode
representation. If the node is a.scalar
, this is a no-op.Declaration
Swift
public subscript(representable: NodeRepresentable) -> Node? { get set }
-
Returns true if
lhs
is ordered beforerhs
.Declaration
Swift
public static func < (lhs: Node, rhs: Node) -> Bool
Parameters
lhs
The left hand side Node to compare.
rhs
The right hand side Node to compare.
Return Value
True if
lhs
is ordered beforerhs
.
-
Create a
Node.sequence
from an array literal ofNode
s.Declaration
Swift
public init(arrayLiteral elements: Node...)
-
Create a
Node.sequence
from an array literal ofNode
s and a defaultStyle
to use for the array literalDeclaration
Swift
public init(arrayLiteral elements: Node..., style: Sequence.Style)
-
Create a
Node.mapping
from a dictionary literal ofNode
s.Declaration
Swift
public init(dictionaryLiteral elements: (Node, Node)...)
-
Create a
Node.mapping
from a dictionary literal ofNode
s and a defaultStyle
to use for the dictionary literal.Declaration
Swift
public init(dictionaryLiteral elements: (Node, Node)..., style: Mapping.Style)
-
Create a
Node.scalar
from a float literal.Declaration
Swift
public init(floatLiteral value: Double)
-
Create a
Node.scalar
from an integer literal.Declaration
Swift
public init(integerLiteral value: Int)
-
Create a
Node.scalar
from a string literal.Declaration
Swift
public init(stringLiteral value: String)
-
Initialize a
Node
with a value ofNodeRepresentable
.Throws
Declaration
Swift
init<T>(_ representable: T) throws where T : NodeRepresentable
Parameters
representable
Value of
NodeRepresentable
to represent as aNode
.
-
This value’s
Node
representation.Declaration
Swift
public func represented() throws -> Node