23

The question was already asked some time ago. But I'm not able to find a nice solution matching to the current Swift version.


Swift 4 - How to cancel a specific call to DispatchQueue.main.asyncAfter?

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
    // my code
}

DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
    // just cancel this event!
}
rmaddy
  • 307,833
  • 40
  • 508
  • 550

0 Answers0