Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1.23 KB

Formatting.md

File metadata and controls

48 lines (30 loc) · 1.23 KB

Formatting and Linting

To maintain a consistent code style across the Untold Engine repo, we use SwiftFormat. SwiftFormat is a code formatter for Swift that helps enforce Swift style conventions and keep the codebase clean.

Installing SwiftFormat

The simplest way to install SwiftFormat is through the command line.

  1. Install SwiftFormat Using Homebrew: Open the terminal and run the following command:
brew install swiftformat
  1. Verify Installation: After installation, verify that SwiftFormat is installed correctly by running:
swiftformat --version

This should print the installed version of SwiftFormat.

Using SwiftFormat

Format a Single File

To format a specific Swift file:

  1. Open the terminal and navigate to your project directory.

  2. Run the following command:

swiftformat path/to/YourFile.swift

This will format YourFile.swift according to the default rules.

Format Multiple Files

To format all Swift files in your project:

  1. Navigate to your project directory in the terminal.

  2. Run the following command:

swiftformat .

This will recursively format all Swift files in the current directory and its subdirectories.