I am trying to build a metronome app, where when activated the app flashes a light and plays a sound in given intervals. However, I don't know where to put a while loop, as putting it inside the viewcontroller prompts an "expected declaration" error. The idea is just for something like:
while metronome_is_on = true {
//code that plays sound/flashes light with given delayed intervals
}
So, where can I run this loop in the app? Or is there a better practice for this?