Skip to content

Commit 5b46142

Browse files
committed
Add dedicated README for SwiftSyntaxBuilder
1 parent 4495871 commit 5b46142

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Sources/SwiftSyntaxBuilder/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SwiftSyntaxBuilder
2+
3+
Declarative and type-safe wrapper around SwiftSyntax.
4+
5+
## Example Usage
6+
7+
```swift
8+
let sourceFile = SourceFile {
9+
Import("SwiftSyntax")
10+
11+
Struct("ExampleStruct") {
12+
Let("syntax", of: "Syntax")
13+
}
14+
}
15+
16+
let syntax = sourceFile.buildSyntax(format: format, leadingTrivia: .zero)
17+
18+
var text = ""
19+
syntax.write(to: &text)
20+
print(text)
21+
```
22+
23+
prints:
24+
25+
```swift
26+
import SwiftSyntax
27+
struct ExampleStruct {
28+
let syntax: Syntax
29+
}
30+
```

0 commit comments

Comments
 (0)