A Swift package for generating Swift code programmatically using declarative, type-safe result builders.
SyntaxKit is a Swift package that enables developers to generate Swift code programmatically using a declarative, type-safe API built on result builders. It solves the problem of manually constructing SwiftSyntax AST nodes by providing a more readable and maintainable way to create code structures for macros, model generators, and other automated code generation tasks.
Swift developers building macros, compiler plugins, code generators, or tools that need to output Swift code from external schemas or configurations.
Developers choose SyntaxKit over manual SwiftSyntax manipulation because it offers a declarative, type-safe API that simplifies code generation, reduces boilerplate, and improves maintainability, especially for complex or repetitive generation tasks.
Generate Swift code programmatically with declarative syntax.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Swift result builders to create readable and maintainable code generation logic, as shown in the quick start examples with struct and enum definitions that mimic Swift's natural syntax.
Ensures generated code structures are correct at compile time, reducing runtime errors and improving reliability for macro and generator development, emphasized in the type-safe API design.
Specifically designed for building Swift macros and compiler plugins, with provided examples and documentation for macro expansion, making it ideal for Swift 6.0+ macro development.
Leverages SwiftSyntax to produce well-formatted, idiomatic Swift code, ensuring the generated code adheres to Swift conventions without manual formatting efforts.
Primarily useful for code generation tasks like macros and model transformers, not suitable for general application development or UI work, as admitted in the 'When to Use' section that recommends regular Swift for app logic.
At version 0.0.4, the API might be unstable with potential breaking changes, and some advanced Swift language features could be incompletely supported, limiting production readiness.
Requires Swift 6.0+ and tight integration with SwiftSyntax, which adds complexity and compatibility constraints for projects on older Swift versions or those avoiding heavy dependencies.