-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f3a24c
commit 6dc62ce
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Formatting and Linting | ||
|
||
To maintain a consistent code style across the Untold Engine repo, we use [SwiftFormat](https://github.com/nicklockwood/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: | ||
|
||
```bash | ||
brew install swiftformat | ||
``` | ||
2. Verify Installation: After installation, verify that SwiftFormat is installed correctly by running: | ||
|
||
```bash | ||
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: | ||
|
||
```bash | ||
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: | ||
|
||
```bash | ||
swiftformat . | ||
``` | ||
|
||
This will recursively format all Swift files in the current directory and its subdirectories. |