How to use a delay

In my app, I am trying to run something, but only if the state of a button has stayed the same for 10 seconds. More specifically, I want to remove an element from an array if the button is checked for 10 seconds without interruption. How would I do this?

The following code is for showing which state the button should be in:

if tasksfinal[indexPath.row].checked {

              cell.checkBoxOutlet.setBackgroundImage(UIImage(named: "checkBoxFILLED"), for: UIControl.State.normal)

//INSERT NEW CODE HERE
} else {
cell.checkBoxOutlet.setBackgroundImage(UIImage(named: “checkBoxOUTLINE”), for: UIControl.State.normal)
}

What do you mean “without interruption?” What would an interruption entail?

You could create a timer after the check, and then whatever qualifies as an interruption invalidate that timer

And then when it hits 10 seconds run whatever code you want