I have a `UIView` subclass called `View`, in which I want a "ripple" to move outwards from wherever the user double clicks (as well as preforming other drawing functions). Here is the relevant part of my `draw` method, at present:

```
override func draw(_ rect: CGRect) {
    for r in ripples {
        r.paint()
    }
}

```

This is how `r.paint()` is implemented, in class `Ripple`:

```
func paint() {
    let c = UIColor(white: CGFloat(1.0 - (Float(iter))/100), alpha: CGFloat(1))
    print(iter, " - ",Float(iter)/100)
    c.setFill()
    view.fillCircle(center: CGPoint(x:x,y:y), radius: CGFloat(iter))
}

```

`iter` is supposed to be incremented every 0.1 seconds by a `Timer` which is started in the constructor of `Ripple`:

```
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: move)

```

`move` is implemented as follows:

```
func move(_ timer: Timer) {
    while (tier<100) {
        iter += 1
        DispatchQueue.main.async {
            self.view.setNeedsDisplay()
        }
    }
    timer.invalidate()
}

```

What is supposed to happen is that every 0.1 seconds when the timer fires, it will increment `iter` and tell the `View` to repaint, which it will then do using the `Ripple.paint()` method, which uses `iter` to determine the color and radius of the circle.

However, as revealed using `print` statements, what happens instead is that the `Timer` fires all 100 times before the redraw actually takes place. I have tried dealing with this by replacing `DispatchQueue.main.async` with `DispatchQueue.main.sync`, but this just made the app hang. What am I doing wrong? If this is just not the right way to approach the problem, how can I get a smooth ripple animation (which involves a circle which grows while changing colors) to take place while the app can still preform other functions such as spawning more ripples? (This means that multiple ripples need to be able to work at once.)