What's New

Version 0.1.0

2025-04-21T20:53:56Z

🚀 Initial Release

This is the first public release of SwiftSyntaxSugar, a library that extends and simplifies interaction with SwiftSyntax, reducing boilerplate and improving ergonomics for developers building Swift tooling.

This initial release includes:

  • Expressive syntax that improves the ergonomics of working with SwiftSyntax types
  • Powerful, convenient extensions that reduce boilerplate when parsing Swift syntax trees
  • A well-tested foundation on which to build Swift tooling

Full Changelog

SwiftSyntaxSugar

ci codecov License

SwiftSyntaxSugar is a library that provides syntactic sugar and helpful extensions for SwiftSyntax. The purpose of this library is to improve the readability and maintainability of code written using SwiftSyntax.

Example

With SwiftSyntaxSugar Without SwiftSyntaxSugar
protocolDeclaration.isActorConstrained    
let isProtocolActorConstrained = protocolDeclaration.inheritanceClause?.inheritedTypes.contains { inheritedType in    
    let identifierType = inheritedType.type.as(IdentifierTypeSyntax.self)
    return identifierType.name.tokenKind == .identifier("Actor")
} ?? false

Installation

To add SwiftSyntaxSugar to a Swift package manifest file:

  • Add the SwiftSyntaxSugar package to your package's dependencies:
    .package(
        url: "https://github.com/fetch-rewards/SwiftSyntaxSugar.git",
        from: "<#latest SwiftSyntaxSugar tag#>"
    )
  • Add the SwiftSyntaxSugar product to your target's dependencies:
    .product(name: "SwiftSyntaxSugar", package: "SwiftSyntaxSugar")

Usage

  • Import SwiftSyntaxSugar:
    import SwiftSyntaxSugar
  • Use SwiftSyntax exactly how you normally would!

Contributing

The simplest way to contribute to this project is by opening an issue.

If you would like to contribute code to this project, please read our Contributing Guidelines.

By opening an issue or contributing code to this project, you agree to follow our Code of Conduct.

License

This library is released under the MIT license. See LICENSE for details.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Tue May 13 2025 23:31:19 GMT-0900 (Hawaii-Aleutian Daylight Time)