Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 1.71 KB

README.md

File metadata and controls

71 lines (54 loc) · 1.71 KB

CodeWriter

Swift Version Swift Package Manager Twitter

Helper library cross platform to write & build source code

Installation

SPM

To install CodeWriter with SwiftPackageManager, add the following lines to your Package.swift.

let package = Package(
    name: "XXX",
    products: [
        .library(
            name: "XXX",
            targets: ["XXX"]),
    ],
    dependencies: [
        .package(url: "https://github.com/Digipolitan/code-writer.git", from: "1.1.0")
    ],
    targets: [
        .target(
            name: "XXX",
            dependencies: ["CodeWriter"])
    ]
)

The Basics

  • Builders
let builder = CodeBuilder()
builder.add(line: "if test {")
    .rightTab()
    .add(line: "print(\"ok\")")
    .leftTab()
    .add(line: "}")
let res = builder.build()
print("\(res)")

Output

if test {
    print("ok")
}
  • Writers

The write interface provide the method to override in sub project

Contributing

See CONTRIBUTING.md for more details!

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

License

CodeWriter is licensed under the BSD 3-Clause license.