Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 430 Bytes

README.md

File metadata and controls

19 lines (12 loc) · 430 Bytes

Introduction

The built in dispatch after function does not allow the call to be cancelled. This prevents the block being called if cancelled through the use of tokens.

Installation

Add the swift file to your project

Usage

let t = DispatchQueue.main.asyncAfterC(deadline: DispatchTime(timeIntervalSinceNow: 10), execute: { 
    print("Executed 1")
})

// cancel

DispatchQueue.asyncAfterCCancel(token: t)