Multiline Arguments

Arguments should be either on the same line, or one per line

  • Identifier: multiline_arguments
  • Enabled by default: No
  • Supports autocorrection: No
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning
    first_argument_location any_line
    only_enforce_after_first_closure_on_first_line false

Non Triggering Examples

foo()
foo(
)
foo { }
foo {

}
foo(0)
foo(0, 1)
foo(0, 1) { }
foo(0, param1: 1)
foo(0, param1: 1) { }
foo(param1: 1)
foo(param1: 1) { }
foo(param1: 1, param2: true) { }
foo(param1: 1, param2: true, param3: [3]) { }
foo(param1: 1, param2: true, param3: [3]) {
    bar()
}
foo(param1: 1,
    param2: true,
    param3: [3])
foo(
    param1: 1, param2: true, param3: [3]
)
foo(
    param1: 1,
    param2: true,
    param3: [3]
)
Picker(selection: viewStore.binding(\.$someProperty)) {
   ForEach(SomeEnum.allCases, id: \.rawValue) { someCase in
      Text(someCase.rawValue)
         .tag(someCase)
   }
} label: {
   EmptyView()
}
UIView.animate(withDuration: 1,
               delay: 0) {
    // sample
    print("a")
} completion: { _ in
    // sample
    print("b")
}
UIView.animate(withDuration: 1, delay: 0) {
    print("a")
} completion: { _ in
    print("b")
}

Triggering Examples

foo(0,
    param1: 1, param2: true, param3: [3])
foo(0, param1: 1,
    param2: true, param3: [3])
foo(0, param1: 1, param2: true,
    param3: [3])
foo(
    0, param1: 1,
    param2: true, param3: [3]
)