Vertical Parameter Alignment on Call
Function parameters should be aligned vertically if they’re in multiple lines in a method call
- Identifier:
vertical_parameter_alignment_on_call
- Enabled by default: No
- Supports autocorrection: No
- Kind: style
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
foo(param1: 1, param2: bar
param3: false, param4: true)
foo(param1: 1, param2: bar)
foo(param1: 1, param2: bar
param3: false,
param4: true)
foo(
param1: 1
) { _ in }
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
}, completion: { _ in
self.hideLoading()
})
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
},
completion: { _ in
self.hideLoading()
})
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
} { _ in
self.hideLoading()
}
foo(param1: 1, param2: { _ in },
param3: false, param4: true)
foo({ _ in
bar()
},
completion: { _ in
baz()
}
)
foo(param1: 1, param2: [
0,
1
], param3: 0)
myFunc(foo: 0,
bar: baz == 0)
UIViewPropertyAnimator.runningPropertyAnimator(
withDuration: 2.0,
delay: 0.0,
options: [.curveEaseIn]
) {
// animations
} completion: { _ in
// completion
}
Triggering Examples
foo(param1: 1, param2: bar,
↓param3: false, param4: true)
foo(param1: 1, param2: bar,
↓param3: false, param4: true)
foo(param1: 1, param2: bar,
↓param3: false,
↓param4: true)
foo(param1: 1,
↓param2: { _ in })
foo(param1: 1,
param2: { _ in
}, param3: 2,
↓param4: 0)
foo(param1: 1, param2: { _ in },
↓param3: false, param4: true)
myFunc(foo: 0,
↓bar: baz == 0)
myFunc(foo: 0, bar:
baz == 0, ↓baz: true)