Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

A Tuist plugin that can format the project using SwiftFormat.

License

Notifications You must be signed in to change notification settings

lordcodes/swiftformat-tuist

Repository files navigation

Swift Package Manager Latest release Twitter: @lordcodes


This is a SwiftFormat Tuist - a plugin for Tuist to format Swift projects using SwiftFormat.

 

InstallUsageContributing

Install

To set up as a Tuist plugin in your project simply follow the Tuist plugin install instructions using the latest version.

Add the plugin to Config.swift.

import ProjectDescription

let config = Config(
    plugins: [
        .git(url: "https://github.com/lordcodes/swiftformat-tuist.git", tag: "[VERSION]")
    ]
)

 

Usage

🖥 Via the Tuist Plugin

Run SwiftFormat Tuist's tasks via Tuist.

USAGE: tuist swiftformat [<subcommand>]

DEFAULT SUBCOMMAND:
    Run SwiftFormat in format mode.

SUBCOMMANDS:
    format            Run SwiftFormat in format mode.
    lint              Run SwiftFormat in lint mode.
    help              Print this help information.
    version           Print SwiftFormat Tuist version.

See 'tuist swiftformat <subcommand> --help' for detailed help.

The plugin is a lightweight wrapper around the SwiftFormat command-line tool. If no files are specified to lint, it will pass the current directory as the first argument to SwiftFormat.

For example, a common set up would be:

  • Create a .swiftformat config file in the root of the project.
  • List all the files/directories to skip using --excludes.
  • From root run tuist swiftformat to format code.
  • From root run tuist swiftformat lint to check if code is formatted.

Contributing or Help

If you notice any bugs or have a new feature to suggest, please check out the contributing guide. If you want to make changes, please make sure to discuss anything big before putting in the effort of creating the PR.

To reach out, please contact @lordcodes on Twitter.