I would like to create a function with completion handler and I would like to make the handler so I can pass in nil.
func animate(completion: @escaping((Bool) -> ()) {
//Do stuff
completion(true)
}
I would like make the make the completion handler to be able to pass in nil when it's not needed, like:
animate(completion: nil)
It's not working & I get the error:
Nil is not compatible with expected argument type '(Bool?) -> ()
. Can you please help me how to do this?