 
 class LiveView: AKLiveViewController {
 
-    var beatFlasher: AKButton!
+    var beatFlasher: AKButton?
 
     override func viewDidLoad() {
         addTitle("Metronome")

            }
        }

        addView(beatFlasher)

        addView(AKSlider(property: "Subdivision", value: 4, range: 1 ... 10, format: "%0.0f") { sliderValue in
            metronome.subdivision = Int(round(sliderValue))

let view = LiveView()

metronome.callback = {
    view.beatFlasher?.color = .white

    DispatchQueue.main.async {
        view.beatFlasher?.needsDisplay = true
    }

    let deadlineTime = DispatchTime.now() + (60 / metronome.tempo) / 10.0
    DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
        view.beatFlasher?.color = .red
    }
}

