Completion handler with no input argument
suggest changefunc sampleWithCompletion(completion:@escaping (()-> ())){
let delayInSeconds = 1.0
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delayInSeconds) {
completion()
}
}
//Call the function
sampleWithCompletion {
print("after one second")
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents