Skip to content

Latest commit

 

History

History
72 lines (54 loc) · 1.97 KB

File metadata and controls

72 lines (54 loc) · 1.97 KB

PolymorphGen

Swift Version Swift Package Manager Twitter

Base library to generate files, part of the Polymorph project

Installation

SPM

To install PolymorphGen 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/polymorph-gen.git", from: "1.0.0")
    ],
    targets: [
        .target(
            name: "XXX",
            dependencies: ["PolymorphGen"])
    ]
)

The Basics

All child platform must implements the PlatformGen interface and override all fields & methods

class ExampleGen: PlatformGen {
    static var name: String {
        return "Example"
    }
    static var shared: PlatformGen = ExampleGen()

    private init() { }

    func generate(_ project: Project, options: PolymorphGen.Options) throws -> [File] {
        // TODO
    }
}

After that register your platform when initializing the PolymorphGen instance

let generator = PolymorphGen(platforms: [
    ExampleGen.self
])

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 contact@digipolitan.com.

License

PolymorphGen is licensed under the BSD 3-Clause license.