Indenting Swift code
Issue #93
Hi, here is how I indent my code. Let me know what you think đ
Using 2 spaces indentation
When possible, configure your editor to use 2 spaces
for tab size
. You will love it â¤ď¸
Move first parameter to new line
If there are many parameters, move the first parameter to a new line, and align the other parameters. Remember that the last parenthesis )
should align to the function call
1 | let event = NSAppleEventDescriptor( |
You can do the same for function declaration
1 | func collectionView( |
Shouldnât use trailing closure if there are more than 2 closures
Here is how to use UIView.animate
1 | UIView.animate( |
Here is how to use RxSwift subscribe
1 | friendsObservable.subscribe( |
Shouldnât use trailing closure when chaining methods
Also, the next method call should start on same line
1 | let items = [1, 2, 3, 4, 5] |