Contents

fetch-rewards/swiftsyntaxsugar

`SwiftSyntaxSugar` is a library that provides syntactic sugar and helpful extensions for [`SwiftSyntax`](https://github.com/swiftlang/swift-syntax).

Example

<table> <tr> <td> With <code>SwiftSyntaxSugar</code> </td> <td> Without <code>SwiftSyntaxSugar</code> </td> </tr> <tr> <td>

protocolDeclaration.isActorConstrained    

</td> <td>

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

</td> </tr> </table>

Installation

To add SwiftSyntaxSugar to a Swift package manifest file:

  • Add the SwiftSyntaxSugar package to your package's dependencies:

``swift .package( url: "https://github.com/fetch-rewards/SwiftSyntaxSugar.git", from: "<#latest SwiftSyntaxSugar tag#>" ) ``

  • Add the SwiftSyntaxSugar product to your target's dependencies:

``swift .product(name: "SwiftSyntaxSugar", package: "SwiftSyntaxSugar") ``

Usage

  • Import SwiftSyntaxSugar:

``swift 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.

Package Metadata

Repository: fetch-rewards/swiftsyntaxsugar

Default branch: main

README: README.md