How to fix Swift warning in iOS “Multiple Closures with Trailing Closure Violation”

0
26

[ad_1]

I am fairly new to Swift development and I’m getting the following warning:

Multiple Closures with Trailing Closure Violation: Trailing closure
syntax should not be used when passing more than one closure argument
(multiple_closures_with_trailing_closure).

I don’t really understand what the warnings means and how to fix it. I already googled and looked into other posts on Stackoverflow but couldn’t wrap my head around it.

My code looks like this:

Button(action: {
  address = "123 Fakestreet"
  onSubmit()
}) {
  Text("Start search")
}

Question: How can I refactor my code so the functionality stays the same but the warning goes away?

[ad_2]