3

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
  • 128,090
  • 22
  • 218
  • 270
SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96

0 Answers0