I created a function with a completion handler. Sometimes I need to use the completion block, sometimes not.
Here is the function:
func numberCheck(number: String , completion : @escaping (Bool)->()){
//some task do here
completion(true)
}
use:
numberCheck(number: "77" , completion: {_ in
//some task do here
})
But I want to leave it completion block nil:
numberCheck(number: "77" , completion: nil)
but it is gives me an error:
Nil is not compatible with expected argument type '(Bool) -> ()'