Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SwiftFormat #811

Open
onmyway133 opened this issue Jun 27, 2021 · 0 comments
Open

How to use SwiftFormat #811

onmyway133 opened this issue Jun 27, 2021 · 0 comments
Labels

Comments

@onmyway133
Copy link
Owner

Don't add SwiftFormat as SPM package, instead use command line directly

if which swiftformat >/dev/null; then
  swiftformat .
else
  echo "warning: SwiftFormaat not installed, download from https://github.com/nicklockwood/SwiftFormat"
fi

Then install SwiftFormat locally

brew install swiftformat

Then make some rules in any file name with extension .swiftformat

While formatting, SwiftFormat will automatically check inside each subdirectory for the presence of a .swiftformat file and will apply any options that it finds there to the files in that directory.

# format options
--allman true

# file options
--exclude Pods
--exclude DerivedData

# rules
--disable elseOnSameLine,semicolons
@onmyway133 onmyway133 added the iOS label Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant