diff --git a/CHANGELOG.md b/CHANGELOG.md
index d8d39024..6fb7b584 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Change Log
+## [0.19](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.19) (2016-12-02)
+
+- Fixed a critical bug where `redundantParens` rule failed to insert space before a prefix operator
+- Fixed a crash when encountering generic arguments followed by ...
+- Added `--disable` option for individually disabling rules without needing to recompile
+- Added `--rules` command to display all the supported rules (useful in conjunction with `--disable`)
+- Added `--wraparguments` option for controlling how function arguments are wrapped
+- Added `--wrapelements` option for controlling how array and dictionary elements are wrapped
+- Added `--symlinks` option for specifying if symlinks/aliases should be followed and formatted
+- Fixed bug where symlinks to Swift files would be replaced by a copy of the file
+
## [0.18](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.18) (2016-11-17)
- Added `--inferoptions` command line argument for auto-configuring format options from existing source
diff --git a/CommandLineTool/main.swift b/CommandLineTool/main.swift
index a4f71448..49f006ac 100644
--- a/CommandLineTool/main.swift
+++ b/CommandLineTool/main.swift
@@ -2,7 +2,7 @@
// main.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/CommandLineTool/swiftformat b/CommandLineTool/swiftformat
index bfda3ae7..9463ef5b 100755
Binary files a/CommandLineTool/swiftformat and b/CommandLineTool/swiftformat differ
diff --git a/EditorExtension/Application/Info.plist b/EditorExtension/Application/Info.plist
index e28d5b95..47cb27c7 100644
--- a/EditorExtension/Application/Info.plist
+++ b/EditorExtension/Application/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
LSMinimumSystemVersion
diff --git a/EditorExtension/Extension/CommandErrors.swift b/EditorExtension/Extension/CommandErrors.swift
index 23b9268e..437953dd 100644
--- a/EditorExtension/Extension/CommandErrors.swift
+++ b/EditorExtension/Extension/CommandErrors.swift
@@ -2,7 +2,7 @@
// CommandErrors.swift
// Swift Formatter
//
-// Version 0.18
+// Version 0.19
//
// Created by Tony Arnold on 6/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/Info.plist b/EditorExtension/Extension/Info.plist
index 48f4db09..8522913b 100644
--- a/EditorExtension/Extension/Info.plist
+++ b/EditorExtension/Extension/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
LSMinimumSystemVersion
diff --git a/EditorExtension/Extension/SourceEditorExtension.swift b/EditorExtension/Extension/SourceEditorExtension.swift
index bf095e76..e6b1c19e 100644
--- a/EditorExtension/Extension/SourceEditorExtension.swift
+++ b/EditorExtension/Extension/SourceEditorExtension.swift
@@ -2,7 +2,7 @@
// SourceEditorExtension.swift
// Swift Formatter
//
-// Version 0.18
+// Version 0.19
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift b/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
index 34dd0585..bdc2bf5a 100644
--- a/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
+++ b/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
@@ -2,7 +2,7 @@
// XCSourceTextBuffer+SwiftFormat.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright © 2016 Nick Lockwood. All rights reserved.
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib
index 4c66bb88..a0d821cf 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib
index 87962497..b732681c 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib
index 44671925..515b1a68 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib
index f474f086..5f6eb729 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib
index fa28d498..4387880b 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib
index d0e91369..ae9e107b 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib
index bbbfb377..e405fa27 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib
index 1d391443..d0ef3db6 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib
index 57ec1934..1f7cbcd6 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib
index 6749d6b2..2433d476 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib
index 9294be42..4b0209d6 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib
deleted file mode 100755
index b28f0947..00000000
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib and /dev/null differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib
index f334ae96..1f6523ad 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
index 83ff8f69..ae51b03d 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleSupportedPlatforms
MacOSX
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode
index e3fe8eda..1882512d 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode and b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
index bda318eb..b1c43312 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleSupportedPlatforms
MacOSX
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat
index 4d9635ce..03c584cf 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat and b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist
index d6cccaa6..b5f6a0a9 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib
index 88d49353..5ca89653 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
index f9f1e641..6fc785cd 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib
index fcd2c13e..2e30b1a3 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
index efc8c014..57677d17 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
index 6386d53e..11fdae0e 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
@@ -6,23 +6,23 @@
Resources/Base.lproj/Main.storyboardc/Info.plist
- SVeb6wo91KoqRG8b+oZSU9Avt7A=
+ YjYkhDriztgJEVEA6n+U8soGFVk=
Resources/Base.lproj/Main.storyboardc/MainMenu.nib
- sN8O3bl+2BJUw5XUGGsQ8siffSk=
+ t04Htts8onTlxnsH2ugv6VjH+Rw=
Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
- 5+fFBogUnh1rkYGxsn0KkHyhKX0=
+ 4S4JnwHJSdHMNYLIqjdQM9p0ik0=
Resources/Base.lproj/Main.storyboardc/ViewController.nib
- X2cHOjBiTdCe78QmJBR0WLuUl+g=
+ GIIrpDBq6KRTRBCDkJ+mLPp8sYE=
Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
- YF02pwee/elsEubOY2xXqAemPzk=
+ hDxsx6x5l8K4dT8JG6cg0gMSgNY=
Resources/libswiftRemoteMirror.dylib
@@ -130,15 +130,6 @@
requirement
identifier "com.apple.dt.runtime.swiftQuartzCore" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */
- Frameworks/libswiftSwiftOnoneSupport.dylib
-
- cdhash
-
- oYjIzrxU6mKnhdB6cQcN7nWj9+Q=
-
- requirement
- identifier "com.apple.dt.runtime.swiftSwiftOnoneSupport" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */
-
Frameworks/libswiftXPC.dylib
cdhash
@@ -152,7 +143,7 @@
cdhash
- 1T4YIjNlliI+DKLvxMi2wNYFiZE=
+ huPJGCXbfxPkMZRLLGtgzyXWvMc=
requirement
identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */
@@ -161,55 +152,55 @@
hash
- SVeb6wo91KoqRG8b+oZSU9Avt7A=
+ YjYkhDriztgJEVEA6n+U8soGFVk=
hash2
- om7q/0Ol35lOxcSZ34buMe3zHvQV1uReEH/9ZI4BrIk=
+ 1Wc1BiX54CRJdn/Lrdh9aNumi63MLOXR3SM0rz+L78k=
Resources/Base.lproj/Main.storyboardc/MainMenu.nib
hash
- sN8O3bl+2BJUw5XUGGsQ8siffSk=
+ t04Htts8onTlxnsH2ugv6VjH+Rw=
hash2
- tsM5NttIV+NPg3wZOtWaDMMpmUhl9MmFIPYUbZmIkLU=
+ oaLmgw5ed9Wx2i82fXM6/tpQqn1QCVJB/XEKy1qv0V4=
Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
hash
- 5+fFBogUnh1rkYGxsn0KkHyhKX0=
+ 4S4JnwHJSdHMNYLIqjdQM9p0ik0=
hash2
- kXqhlD43R7DrmdCiW9DPYjq4xpDfUBbLIzWnbEm1lWM=
+ sYZZppU2+8ZAkWN6ZEDjICNTRVS/g4QqLEef4O8CRA8=
Resources/Base.lproj/Main.storyboardc/ViewController.nib
hash
- X2cHOjBiTdCe78QmJBR0WLuUl+g=
+ GIIrpDBq6KRTRBCDkJ+mLPp8sYE=
hash2
- 2WfozzASTvlaVNYKyOJdKz7jL2RrkHI/XYlRR+sOAgQ=
+ CyHbI2xgAoB7Ad/P9QY9VD2v60D/CWd1ibugMueE44w=
Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
hash
- YF02pwee/elsEubOY2xXqAemPzk=
+ hDxsx6x5l8K4dT8JG6cg0gMSgNY=
hash2
- HKnfbKws9vvmsK4fozFI4suK+hXXtFs6CQbIxDpMJ1g=
+ rcKitZlRCPLgC16kjU6rmlDs8TozMI8XTD/2s4T3t4w=
Resources/libswiftRemoteMirror.dylib
diff --git a/README.md b/README.md
index b7ab06d2..dcf328fa 100644
--- a/README.md
+++ b/README.md
@@ -34,20 +34,16 @@ That depends. There are four ways you can use SwiftFormat:
Command-line tool
-------------------
-There are multiple options for installing SwiftFormat.
+**Installation:**
-**Homebrew:**
+The simplest way to install the `swiftformat` command-line tool is via [Homebrew](http://brew.sh/). If you already have Homebrew installed, just type
-You can use [Homebrew](http://brew.sh/) and install the SwiftFormat tool on your system simply by running the following:
+ > brew update
+ > brew install swiftformat
+
+Then you're done. Alternatively, to build it yourself from source:
-```
-brew update
-brew install swiftformat
-```
-
-**Manual Installation:**
-
-1. The latest binary version of the `swiftformat` command-line tool is included in the `CommandLineTool` folder. You can either use that, or build it yourself from source. To build it yourself, open `SwiftFormat.xcodeproj` and build the `SwiftFormat (Application)` scheme.
+1. open `SwiftFormat.xcodeproj` and build the `SwiftFormat (Application)` scheme.
2. Drag the `swiftformat` binary into `/usr/local/bin/` (this is a hidden folder, but you can use the Finder's `Go > Go to Folder...` menu to open it).
@@ -75,11 +71,11 @@ To use it safely, do the following:
3. (Optional) In Terminal, type `swiftformat --inferoptions "/path/to/your/code/"`. This will suggest a set of formatting options to use that match your existing project style (but you are free to ignore these and use the defaults, or your own settings if you prefer).
- The path can point to either a single Swift file, or a directory of files. It can be either be absolute, or relative to the current directory. The `""` quotes around the path are optional, but if the path contains spaces then you either need to use quotes, or escape each space with `\`.
+ The path can point to either a single Swift file, or a directory of files. It can be either be absolute, or relative to the current directory. The `""` quotes around the path are optional, but if the path contains spaces then you either need to use quotes, or escape each space with `\`.
4. In Terminal, type `swiftformat "/path/to/your/code/"`. The same rules apply as above with respect to path formatting, but you can enter multiple paths if you wish, separated by spaces.
- If you used `--inferoptions` to generate a suggested set of options in step 3, you should copy and paste them into the command, either before or after the path(s) to your source files.
+ If you used `--inferoptions` to generate a suggested set of options in step 3, you should copy and paste them into the command, either before or after the path(s) to your source files.
5. Press enter to begin formatting. Once the formatting is complete, use your source control system to check the changes, and verify that no undesirable changes have been introduced. If they have, revert the changes, tweak the options and try again.
@@ -156,44 +152,44 @@ Here are all the rules that SwiftFormat currently applies:
init (foo) --> init(foo)
switch(x){ --> switch (x) {
-
+
*spaceInsideParens* - removes the space inside ( ). For example:
- ( a, b ) --> (a, b)
-
+ ( a, b ) --> (a, b)
+
*spaceAroundBrackets* - contextually adjusts the space around [ ]. For example:
- foo as[String] --> foo as [String]
-
- foo = bar [5] --> foo = bar[5]
+ foo as[String] --> foo as [String]
+
+ foo = bar [5] --> foo = bar[5]
*spaceInsideBrackets* - removes the space inside [ ]. For example:
- [ 1, 2, 3 ] --> [1, 2, 3]
+ [ 1, 2, 3 ] --> [1, 2, 3]
*spaceAroundBraces* - contextually adds space around { }. For example:
- foo.filter{ return true }.map{ $0 } --> foo.filter { return true }.map { $0 }
-
- foo({}) --> foo({})
+ foo.filter{ return true }.map{ $0 } --> foo.filter { return true }.map { $0 }
+
+ foo({}) --> foo({})
*spaceInsideBraces* - adds space inside { }. For example:
- foo.filter {return true} --> foo.filter { return true }
+ foo.filter {return true} --> foo.filter { return true }
*spaceAroundGenerics* - removes the space around < >. For example:
- Foo () --> Foo()
+ Foo () --> Foo()
*spaceInsideGenerics* - removes the space inside < >. For example:
- Foo< Bar, Baz > --> Foo
+ Foo< Bar, Baz > --> Foo
*spaceAroundOperators* - contextually adjusts the space around infix operators:
- foo . bar() --> foo.bar()
-
- a+b+c --> a + b + c
+ foo . bar() --> foo.bar()
+
+ a+b+c --> a + b + c
*spaceAroundComments* - adds space around /* ... */ comments and before // comments:
@@ -203,7 +199,7 @@ Here are all the rules that SwiftFormat currently applies:
*spaceInsideComments* - adds space inside /* ... */ comments and at the start of // comments:
- let a = 5 //assignment --> let a = 5 // assignment
+ let a = 5 //assignment --> let a = 5 // assignment
func foo() { /*no-op*/ } --> func foo() { /* no-op */ }
@@ -229,8 +225,8 @@ Here are all the rules that SwiftFormat currently applies:
]
]
- if x { if x {
- print("x") print("x")
+ if x { if x {
+ print("x") print("x")
} else if y { --> } else if y {
print("y") print("y")
@@ -239,17 +235,17 @@ Here are all the rules that SwiftFormat currently applies:
*blankLinesBetweenScopes* - adds a blank line before each class, struct, enum, extension, protocol or function:
- func foo() { func foo() {
+ func foo() { func foo() {
//foo //foo
} }
- func bar() {
+ func bar() {
//bar --> func bar() {
} //bar
var baz: Bool }
var quux: Int
var baz: Bool
- var quux: Int
-
+ var quux: Int
+
*linebreakAtEndOfFile* - ensures that the last line of the file is empty
*indent* - adjusts leading whitespace based on scope and line wrapping:
@@ -271,10 +267,10 @@ Here are all the rules that SwiftFormat currently applies:
if x if x {
{ //foo
//foo }
- } --> else {
+ } --> else {
else //bar
{ }
- //bar
+ //bar
}
*elseOnSameLine* - controls whether an `else`, `catch` or `while` after a `}` appears on the same line:
@@ -310,13 +306,13 @@ Here are all the rules that SwiftFormat currently applies:
*void* - standardizes the use of `Void` vs an empty tuple `()` to represent empty argument lists and return values:
- let foo: () -> () --> let foo: () -> Void
-
- let bar: Void -> Void --> let bar: () -> Void
-
- let baz: (Void) -> Void --> let baz: () -> Void
-
- func quux() -> (Void) --> func quux() -> Void
+ let foo: () -> () --> let foo: () -> Void
+
+ let bar: Void -> Void --> let bar: () -> Void
+
+ let baz: (Void) -> Void --> let baz: () -> Void
+
+ func quux() -> (Void) --> func quux() -> Void
*todos* - ensures that `TODO:`, `MARK:` and `FIXME:` comments include the trailing colon (else they're ignored by Xcode)
@@ -331,7 +327,7 @@ Here are all the rules that SwiftFormat currently applies:
let foo = 5; let bar = 6 --> let foo = 5
let bar = 6
- return; --> return;
+ return; --> return;
goto(fail) goto(fail)
*linebreaks* - normalizes all linebreaks to use the same character, as specified in options (either CR, LF or CRLF).
@@ -346,24 +342,38 @@ Here are all the rules that SwiftFormat currently applies:
*redundantParens* - removes unnecessary parens from around `if`, `while` or `switch` conditions:
- if (foo == true) {} --> if foo == true {}
-
- while (i < bar.count) {} --> while i < bar.count {}
-
+ if (foo == true) {} --> if foo == true {}
+
+ while (i < bar.count) {} --> while i < bar.count {}
+
*redundantGet* - removes unnecessary `get { }`clause from inside read-only computed properties:
- var foo: Int { var foo: Int {
- get { return 5
- return 5 --> }
- }
- }
-
+ var foo: Int { var foo: Int {
+ get { return 5
+ return 5 --> }
+ }
+ }
+
*hexLiterals* - converts all hex literals to upper- or lower-case, depending on settings:
let color = 0xFF77A5 --> let color = 0xff77a5
-
+
*stripHeaders* - removes the comment header blocks that Xcode adds to the top of each file (off by default).
+*wrapArguments* - wraps function arguments and array elements depending on the mode specified. E.g. for `beforeFirst`:
+
+ func foo(bar: Int, func foo(
+ baz: String) { bar: Int,
+ ... --> baz: String
+ } ) {
+ ...
+ }
+
+ let foo = [bar, let foo = [
+ baz, --> bar,
+ quux] baz,
+ quux
+ ]
FAQ
-----
@@ -444,53 +454,53 @@ Known issues
* The formatted file cache is based on file length, so it's possible (though unlikely) that an edited file will have the exact same character count as the previously formatted version, causing SwiftFormat to incorrectly identify it as not having changed, and fail to format it.
- To fix this, you can type an extra space in the file (which SwiftFormat will then remove again when it applies the formatting).
-
- Alternatively, use the command line option `--cache ignore` to force SwiftFormat to ignore the cache for this run.
+ To fix this, you can type an extra space in the file (which SwiftFormat will then remove again when it applies the formatting).
+
+ Alternatively, use the command line option `--cache ignore` to force SwiftFormat to ignore the cache for this run.
* If a file begins with a comment, the `stripHeaders` rule will remove it if is followed by a blank line. To avoid this, make sure that the first comment is directly followed by a line of code.
* SwiftFormat currently reformats multiline comment blocks without regard for the original indenting. That means
- /* some documentation
-
- func codeExample() {
- print("Hello World")
- }
-
- */
-
- Will become
-
- /* some documentation
-
- func codeExample() {
- print("Hello World")
- }
-
- */
-
- To work around that, you can disable automatic indenting of comments using the `comments` command line flag.
-
- Alternatively, if you prefer to leave the comment indenting feature enabled, you can rewrite your multiline comment as a block of single-line comments...
-
- // some documentation
- //
- // func codeExample() {
- // print("Hello World")
- // }
- //
- //
-
- Or begin each line with a `*` (or any other non-whitespace character)
-
- /* some documentation
- *
- * func codeExample() {
- * print("Hello World")
- * }
- *
- */
+ /* some documentation
+
+ func codeExample() {
+ print("Hello World")
+ }
+
+ */
+
+ Will become
+
+ /* some documentation
+
+ func codeExample() {
+ print("Hello World")
+ }
+
+ */
+
+ To work around that, you can disable automatic indenting of comments using the `comments` command line flag.
+
+ Alternatively, if you prefer to leave the comment indenting feature enabled, you can rewrite your multiline comment as a block of single-line comments...
+
+ // some documentation
+ //
+ // func codeExample() {
+ // print("Hello World")
+ // }
+ //
+ //
+
+ Or begin each line with a `*` (or any other non-whitespace character)
+
+ /* some documentation
+ *
+ * func codeExample() {
+ * print("Hello World")
+ * }
+ *
+ */
Credits
@@ -498,6 +508,7 @@ Credits
* @tonyarnold - Xcode Source Editor Extension
* @bourvill - Git pre-commit hook script
+* @palleas - Homebrew formula
* @nicklockwood - Everything else
([Full list of contributors](https://github.com/nicklockwood/SwiftFormat/graphs/contributors))
diff --git a/SwiftFormat.podspec.json b/SwiftFormat.podspec.json
index 2029beef..c73d2e80 100644
--- a/SwiftFormat.podspec.json
+++ b/SwiftFormat.podspec.json
@@ -1,6 +1,6 @@
{
"name": "SwiftFormat",
- "version": "0.18",
+ "version": "0.19",
"license": {
"type": "zlib",
"file": "LICENCE.md"
@@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/SwiftFormat.git",
- "tag": "0.18"
+ "tag": "0.19"
},
"source_files": "SwiftFormat",
"requires_arc": true,
diff --git a/SwiftFormat.xcodeproj/xcshareddata/xcschemes/SwiftFormat (Editor Extension).xcscheme b/SwiftFormat.xcodeproj/xcshareddata/xcschemes/SwiftFormat (Editor Extension).xcscheme
index 5624e066..49584127 100644
--- a/SwiftFormat.xcodeproj/xcshareddata/xcschemes/SwiftFormat (Editor Extension).xcscheme
+++ b/SwiftFormat.xcodeproj/xcshareddata/xcschemes/SwiftFormat (Editor Extension).xcscheme
@@ -57,7 +57,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleSignature
????
CFBundleVersion
diff --git a/SwiftFormat/Options.swift b/SwiftFormat/Options.swift
index 45828a37..e97dbb7c 100644
--- a/SwiftFormat/Options.swift
+++ b/SwiftFormat/Options.swift
@@ -2,7 +2,7 @@
// Rules.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/Rules.swift b/SwiftFormat/Rules.swift
index a79bc4f8..f31911de 100644
--- a/SwiftFormat/Rules.swift
+++ b/SwiftFormat/Rules.swift
@@ -2,7 +2,7 @@
// Rules.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/SwiftFormat.h b/SwiftFormat/SwiftFormat.h
index 3fc3712f..ef33401d 100644
--- a/SwiftFormat/SwiftFormat.h
+++ b/SwiftFormat/SwiftFormat.h
@@ -2,7 +2,7 @@
// SwiftFormat.h
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/SwiftFormat.swift b/SwiftFormat/SwiftFormat.swift
index 4fcfcd5c..300f4fe9 100644
--- a/SwiftFormat/SwiftFormat.swift
+++ b/SwiftFormat/SwiftFormat.swift
@@ -2,7 +2,7 @@
// SwiftFormat.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
@@ -34,7 +34,7 @@
import Foundation
/// The current SwiftFormat version
-public let version = "0.18"
+public let version = "0.19"
/// Errors
public enum FormatError: Error, CustomStringConvertible {
diff --git a/SwiftFormat/Tokenizer.swift b/SwiftFormat/Tokenizer.swift
index d53dad44..16b38020 100644
--- a/SwiftFormat/Tokenizer.swift
+++ b/SwiftFormat/Tokenizer.swift
@@ -2,7 +2,7 @@
// Tokenizer.swift
// SwiftFormat
//
-// Version 0.18
+// Version 0.19
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormatTests/Info.plist b/SwiftFormatTests/Info.plist
index ed5f18af..f7fde5ec 100644
--- a/SwiftFormatTests/Info.plist
+++ b/SwiftFormatTests/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.18
+ 0.19
CFBundleSignature
????
CFBundleVersion