I found the answer to this question on another forum. My apologies I worded it badly and didn’t know how to edit the post or put my code in block form so it was long winded. It turns out the answer is to call your function on a background thread like this to run a function called Kick_Snare in this case.
DispatchQueue.global(qos: .userInitiated).async { Kick_Snare()}
The loop then runs in parallel to the user interface and the buttons are available.
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags: