import SwiftSyntaxBuilder

/// This example will print the following example:
/// 
///```
/// import Foundation
/// import UIKit
/// class SomeViewController{
///    let tableView: UITableView
/// }
///```

let source = SourceFile {
  ImportDecl(path: "Foundation")
  ImportDecl(path: "UIKit")
  ClassDecl(identifier: "SomeViewController") {
    VariableDecl(.let, name: "tableView", type: "UITableView")
  }
}

let syntax = source.buildSyntax(format: Format())

var text = ""
syntax.write(to: &text)

print(text)

import SwiftSyntaxBuilder

/// This example will print the following example:
/// 
///```
/// import Foundation
/// import UIKit
/// class SomeViewController{
///    let tableView: UITableView
/// }
///```

let source = SourceFile {
  ImportDecl(path: "Foundation")
  ImportDecl(path: "UIKit")
  ClassDecl(classKeyword: .class, identifier: "SomeViewController", membersBuilder: {
    VariableDecl(.let, name: "tableView", type: "UITableView")
  })
}

let syntax = source.buildSyntax(format: Format())

var text = ""
syntax.write(to: &text)

print(text)

--- 
+++ 
@@ -13,9 +13,9 @@
 let source = SourceFile {
   ImportDecl(path: "Foundation")
   ImportDecl(path: "UIKit")
-  ClassDecl(classKeyword: .class, identifier: "SomeViewController", membersBuilder: {
+  ClassDecl(identifier: "SomeViewController") {
     VariableDecl(.let, name: "tableView", type: "UITableView")
-  })
+  }
 }
 
 let syntax = source.buildSyntax(format: Format())
Use trailing closure in code generation example
