You can bind an arbitrary expression to a named value in a capture list,
the expression is evaluated when the closure is created. In your case
you would bind self.i:
dispatch_after(dispatchTime, dispatch_get_main_queue(), { [i = self.i] in
self.test(i)
})