In my app delegate I have put the callback to stop the program when the window is shut.
func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
return true
}
This doesn't work however because (I assume) there is an async bluetooth task running. What is the best way to stop everything running and clean up?
I use this approach