Completion handler with no input argument

suggest change
func sampleWithCompletion(completion:@escaping (()-> ())){
    let delayInSeconds = 1.0
    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delayInSeconds) {
        
        completion()
        
    }
}

//Call the function
sampleWithCompletion {
    print("after one second")
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents