2

I want to use Optional @escaping closures to execute something when the closure is called in the function, but if i make it optional like that:

func checkForFavorites(_ completion: (@escaping (Bool) -> Void)?) {

}

i get this error

@escaping attribute may only be used in function parameter position

This may be an easy question so please have understanding

Sulthan
  • 123,697
  • 21
  • 207
  • 260
SwiftNewling
  • 712
  • 4
  • 20

0 Answers0