How can I programmatically catch the case when completion does not execute?
I can not modify exists
method, because this is a simple replacer for a Firebase observe
.
func exists(completion: (_ a: Int) -> ()) {
//async call with a completion handler where I get the `a` value
if a % 2 == 0 {
completion(a)
}
..............//other cases
}
func check() {
exists { a in
print(a)
}
}
I thought of some flag, but how do I know that exists
ended?