Functions
The following functions are available globally.
-
dump(objects:canonical: indent: width: allowUnicode: lineBreak: explicitStart: explicitEnd: version: sortKeys: sequenceStyle: mappingStyle: newLineScalarStyle: ) Produce a YAML string from objects.
Throws
Declaration
Swift
public func dump<Objects>( objects: Objects, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) throws -> String where Objects: SequenceParameters
objectsSequence of Objects.
canonicalOutput should be the “canonical” format as in the YAML specification.
indentThe indentation increment.
widthThe preferred line width. @c -1 means unlimited.
allowUnicodeUnescaped non-ASCII characters are allowed if true.
lineBreakPreferred line break.
explicitStartExplicit document start
---.explicitEndExplicit document end
....versionYAML version directive.
sortKeysWhether or not to sort Mapping keys in lexicographic order.
sequenceStyleThe style for sequences (arrays / lists)
mappingStyleThe style for mappings (dictionaries)
Return Value
YAML string.
-
dump(object:canonical: indent: width: allowUnicode: lineBreak: explicitStart: explicitEnd: version: sortKeys: sequenceStyle: mappingStyle: newLineScalarStyle: redundancyAliasingStrategy: ) Produce a YAML string from an object.
Throws
Declaration
Swift
public func dump( object: Any?, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any, redundancyAliasingStrategy: RedundancyAliasingStrategy? = nil) throws -> StringParameters
objectObject.
canonicalOutput should be the “canonical” format as in the YAML specification.
indentThe indentation increment.
widthThe preferred line width. @c -1 means unlimited.
allowUnicodeUnescaped non-ASCII characters are allowed if true.
lineBreakPreferred line break.
explicitStartExplicit document start
---.explicitEndExplicit document end
....versionYAML version directive.
sortKeysWhether or not to sort Mapping keys in lexicographic order.
sequenceStyleThe style for sequences (arrays / lists)
mappingStyleThe style for mappings (dictionaries)
Return Value
YAML string.
-
serialize(nodes:canonical: indent: width: allowUnicode: lineBreak: explicitStart: explicitEnd: version: sortKeys: sequenceStyle: mappingStyle: newLineScalarStyle: redundancyAliasingStrategy: ) Declaration
Swift
public func serialize<Nodes>( nodes: Nodes, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any, redundancyAliasingStrategy: RedundancyAliasingStrategy? = nil) throws -> String where Nodes: Sequence, Nodes.Iterator.Element == NodeParameters
nodesSequence of
Nodes.canonicalOutput should be the “canonical” format as in the YAML specification.
indentThe indentation increment.
widthThe preferred line width. @c -1 means unlimited.
allowUnicodeUnescaped non-ASCII characters are allowed if true.
lineBreakPreferred line break.
explicitStartExplicit document start
---.explicitEndExplicit document end
....versionYAML version directive.
sortKeysWhether or not to sort Mapping keys in lexicographic order.
sequenceStyleThe style for sequences (arrays / lists)
mappingStyleThe style for mappings (dictionaries)
Return Value
YAML string.
-
serialize(node:canonical: indent: width: allowUnicode: lineBreak: explicitStart: explicitEnd: version: sortKeys: sequenceStyle: mappingStyle: newLineScalarStyle: redundancyAliasingStrategy: ) Declaration
Swift
public func serialize( node: Node, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any, redundancyAliasingStrategy: RedundancyAliasingStrategy? = nil) throws -> StringParameters
nodeNode.canonicalOutput should be the “canonical” format as in the YAML specification.
indentThe indentation increment.
widthThe preferred line width. @c -1 means unlimited.
allowUnicodeUnescaped non-ASCII characters are allowed if true.
lineBreakPreferred line break.
explicitStartExplicit document start
---.explicitEndExplicit document end
....versionYAML version directive.
sortKeysWhether or not to sort Mapping keys in lexicographic order.
sequenceStyleThe style for sequences (arrays / lists)
mappingStyleThe style for mappings (dictionaries)
Return Value
YAML string.
-
Parse all YAML documents in a String and produce corresponding Swift objects.
Throws
YamlError
Declaration
Swift
public func load_all(yaml: String, _ resolver: Resolver = .default, _ constructor: Constructor = .default, _ encoding: Parser.Encoding = .default) throws -> YamlSequence<Any>Parameters
yamlString
resolverResolver
constructorConstructor
encodingParser.Encoding
Return Value
YamlSequence
-
Parse the first YAML document in a String and produce the corresponding Swift object.
Throws
YamlError
Declaration
Swift
public func load(yaml: String, _ resolver: Resolver = .default, _ constructor: Constructor = .default, _ encoding: Parser.Encoding = .default) throws -> Any?Parameters
yamlString
resolverResolver
constructorConstructor
encodingParser.Encoding
Return Value
Any?
-
Parse all YAML documents in a String and produce corresponding representation trees.
Throws
YamlError
Declaration
Swift
public func compose_all(yaml: String, _ resolver: Resolver = .default, _ constructor: Constructor = .default, _ encoding: Parser.Encoding = .default) throws -> YamlSequence<Node>Parameters
yamlString
resolverResolver
constructorConstructor
encodingParser.Encoding
Return Value
YamlSequence
-
Parse the first YAML document in a String and produce the corresponding representation tree.
Throws
YamlError
Declaration
Swift
public func compose(yaml: String, _ resolver: Resolver = .default, _ constructor: Constructor = .default, _ encoding: Parser.Encoding = .default) throws -> Node?Parameters
yamlString
resolverResolver
constructorConstructor
encodingParser.Encoding
Return Value
Node?
View on GitHub
Install in Dash
Functions Reference