A Swift library for parsing and emitting YAML, built on LibYAML with support for Codable, standard library types, and native node representation.
Yams is a YAML parser and emitter for Swift, built on LibYAML. It provides a native and efficient way to work with YAML data in Swift applications, serving as a foundational tool for configuration parsing, data serialization, and interoperability with YAML-based systems.
Swift developers who need to parse or generate YAML data, such as those working on configuration management, data serialization, or integrating with YAML-based systems in iOS, macOS, or server-side Swift projects.
Developers choose Yams for its performance, Swift idiomatic design, and multiple abstraction levels that balance convenience with control, including Codable support, standard library type conversion, and native node representation for fine-grained formatting.
A Sweet and Swifty YAML parser.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Seamlessly encodes and decodes Swift Codable types with low computational overhead, equivalent to Yams.Node, as demonstrated in the example with struct S and YAMLEncoder/YAMLDecoder.
Direct conversion between YAML and Swift's Dictionary, Array, and Any types using Yams.dump and Yams.load, facilitating easy interoperability with tools like JSONSerialization.
Provides access to Yams.Node for manipulating YAML structure and styles, such as setting flow or block styles, shown in the serialize example with customizable mappings and sequences.
Supports deep conversion to NSMutableDictionary and NSMutableArray via custom constructors, essential for mixed Swift/Objective-C codebases, as illustrated in the NSMutable* example.
YAMLDecoder conforms to TopLevelDecoder, enabling integration into Combine pipelines for reactive data processing, exemplified in the fetchBook function using decode operator.
Yams.load for Swift standard library types has the largest computational overhead due to up-front type inference via regex matching, as admitted in the README, which can slow down parsing for complex data.
Being built on LibYAML means Yams inherits any bugs, limitations, or lag in supporting newer YAML spec versions, and adds complexity with C library integration for Swift projects.
Parsing loads the entire YAML document into memory, which may not scale well for very large files or real-time processing scenarios where streaming would be preferable.