swiftgen

0.1.4 • Public • Published

SwiftGen

SwiftGen is a tool to convert TypeScript files into Swift code.

Getting Started

Installation

To install the package, run:

npm install -g swiftgen

Configuration

Create a config.json file in your project directory. Example configuration:

{
  "inputDir": "path/to/ts-files/root/dir",
  "outputDir": "path/to/output/dir",
  "outputPrefix": "",
  "outputSuffix": ".swift",
  "outputFileName": "TypeSwift",
  "debug": false
}
  • inputDir: Path to TypeScript files that will be converted to Swift. The search is recursive.
  • outputDir: Path to export the generated Swift file. It will replace any existing files with the same name and path.

Usage

If you want to use a custom configuration file, run SwiftGen with the following command:

swiftgen --config path/to/config.json

If no configuration file is specified, SwiftGen will use the default config.json located in the config directory.

Example

  1. Create a config.json file in your project directory with the desired configuration.

  2. Run the tool:

swiftgen --config /path/to/config.json

Or, if the config.json file is in your project root, simply:

swiftgen

Compatible with both relative and absolute paths.

Updating SwiftGen

If you have installed SwiftGen globally and want to update it to the latest version, run:

npm update -g swiftgen

Alternatively, you can uninstall and reinstall the package:

npm uninstall -g swiftgen
npm install -g swiftgen

Additional Information

For more details, refer to the TypeSwift project on GitHub.

Package Sidebar

Install

npm i swiftgen

Weekly Downloads

5

Version

0.1.4

License

MIT

Unpacked Size

20.9 kB

Total Files

15

Last publish

Collaborators

  • buzsh