Video Tutorial: Beginning Core Graphics Part 1: Getting Started

I’m trying create waveform library. I have audio and I draw waveform of audio on screen. This is what I done

when audio playing, I want to show current position playing. So if current time of audio is 1s I need compute X coordination (something like this X = computeByZooming(time) ) and draw it on screen, when it draw finish, I will check if audio still play I will redraw blue line at new X position(remove blue line previous) and so on… If I don’t know when first line finish draw I can’t draw next line at next position. Because I have just learnt IOS in one month so I haven’t more ideas to resolve this problem if you have one please suggest me and I want to say sorry if I have any stupid questions