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
.
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 |
To add SwiftSyntaxSugar
to a Swift package manifest file:
- Add the
SwiftSyntaxSugar
package to your package'sdependencies
:.package( url: "https://github.com/fetch-rewards/SwiftSyntaxSugar.git", from: "<#latest SwiftSyntaxSugar tag#>" )
- Add the
SwiftSyntaxSugar
product to your target'sdependencies
:.product(name: "SwiftSyntaxSugar", package: "SwiftSyntaxSugar")
- Import
SwiftSyntaxSugar
:import SwiftSyntaxSugar
- Use
SwiftSyntax
exactly how you normally would!
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.
This library is released under the MIT license. See LICENSE for details.