summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2022-04-05 14:40:13 +0200
committerAndrej Mihajlov <and@mullvad.net>2022-08-03 15:13:33 +0200
commite6addcb8d673312b20ead6f3229a42c14da69934 (patch)
tree2d87106ceb42cec49f28b6c39b1576bda8f0d60d /ios
parent8a094005ac3e1289e416cf2d85fd47b2904505cf (diff)
downloadmullvadvpn-e6addcb8d673312b20ead6f3229a42c14da69934.tar.xz
mullvadvpn-e6addcb8d673312b20ead6f3229a42c14da69934.zip
Add swift-format
Diffstat (limited to 'ios')
-rw-r--r--ios/.swiftformat14
-rw-r--r--ios/README.md22
2 files changed, 36 insertions, 0 deletions
diff --git a/ios/.swiftformat b/ios/.swiftformat
new file mode 100644
index 0000000000..ed479f35bd
--- /dev/null
+++ b/ios/.swiftformat
@@ -0,0 +1,14 @@
+# file options
+--exclude Build, .spm, MullvadVPNScreenshots/SnapshotHelper.swift
+
+# general options
+--swiftversion 5.5
+
+# format options
+--indent 4
+--maxwidth 100
+--wraparguments before-first
+--wrapcollections before-first
+--wrapternary before-operators
+--redundanttype inferred
+--disable initCoderUnavailable, redundantReturn, unusedArguments, redundantRawValues, preferKeyPath
diff --git a/ios/README.md b/ios/README.md
index a6ba7a35f9..560c7f4cff 100644
--- a/ios/README.md
+++ b/ios/README.md
@@ -12,6 +12,28 @@ instructions document.
[changelog]: CHANGELOG.md
[Configure Xcode project]: BuildInstructions.md#configure-xcode-project
+## Code formatting
+
+The codebase is formatted using [SwiftFormat](https://github.com/nicklockwood/SwiftFormat). Please
+format all contributions using the latest version of formatter.
+
+```
+swiftformat ios/
+```
+
+Install the latest version of SwiftFormat via Homebrew:
+
+```
+brew install swiftformat
+```
+
+CI uses the latest version available on Homebrew to check formatting, so please keep your local
+installation up to date, if you see it complain:
+
+```
+brew upgrade swiftformat
+```
+
## Screenshots for AppStore
The process of taking AppStore screenshots is automated using a UI Testing bundle and Snapshot tool,