This is the first public release of YAMLCoder, a native Swift library for parsing, serializing, encoding, and decoding YAML.
Highlights
YAMLDecoderandYAMLEncoderwith SwiftCodablesupport- Direct YAML tree access through
YAMLValue - YAML 1.2 scalar resolution by default, with YAML 1.1 support
- Block and flow collections
- Multi-document YAML streams
- Anchors, aliases, merge keys, and complex mapping keys
- Configurable duplicate-key handling:
.error(default).keepFirst.keepLast
- Timestamp and Base64 binary value support
- String,
Data, and local file input - In-memory and streaming file scanners
- Configurable resource limits for untrusted input
- Source-located parser errors with line and column information
- DocC comments for all public APIs
YAML Test Matrix
Validated against yaml-test-matrix:
- Event tests: 308 OK, 0 differences, 0 errors
- JSON tests: 279 OK, 29 N/A, 0 differences, 0 errors
- Expected unsupported JSON cases: 17 N/A + Error
Requirements
- Swift 6.2 or later
- macOS 12 or later
- iOS 15 or later
Installation
Add YAMLCoder through Swift Package Manager:
.package(
url: "https://github.com/zhiqiangj217/YAMLCoder.git",
exact: "0.0.1"
)
Then add the product to your target:
.product(name: "YAMLCoder", package: "YAMLCoder")
YAMLCoder is available under the MIT or Apache 2.0 license.