Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored

1.5k views Asked by At
@IBAction func promptForLocation(_ sender: Any) {
  
let submitAction = UIAlertAction(
            title: "Submit",
            style: .default

        ) { // error Line(This line
           
            guard let newLocation = alert.textFields?.first?.text
            else {
                return
            }


// how to fix this error?
1

There are 1 answers

0
Duncan C On

Add “_ in” at the location of “error line”.

That means "I Expect a parameter that this closure will ignore.”