1

I'm relatively new to Swift and am receiving a Multiple Closures with Trailing Closure Violation:... warning from SwiftLint. My code that causes this looks like:

self.start(loggedIn: { _, error in
    //...
// below line causes warning
}) { [weak self] (someInfo: SomeInfo?, error: ErrorType) in
    //...
}
Stunner
  • 12,025
  • 12
  • 86
  • 145

1 Answers1

1

This comment details how one would go about this with an example:

UIView.animate(withDuration: 1.0, animations: {
    self.view.alpha = 0.0
}, completion: { _ in
    self.view.removeFromSuperview()
})

So in this case it would be:

self.start(loggedIn: { _, error in
    //...
}, started: { [weak self] (_: SomeInfo?, error: ErrorType) in
    //...
})
Stunner
  • 12,025
  • 12
  • 86
  • 145
  • Yeah but they’re wrong. What you had to start with is just fine. – matt Mar 17 '20 at 06:13
  • Yeah but unfortunately it's not up to me what rules and standards are enforced through *SwiftLint* in the CI system. :/ – Stunner Mar 19 '20 at 00:02