Usage:
let debouncedWorkItem = DispatchQueue.main.debounce(after: 2000) { value in
print("Hello World", value ?? "")
}
for i in 0...5 {
DispatchQueue.global().asyncAfter(deadline: .now() + TimeInterval(i)) {
debouncedWorkItem(i)
}
}
Will print Hello World 5