I'm trying to do a an status item with a single button that sounds a beep when pressed.
But nothing is playing when pressing. This is the code:
import SwiftUI
import AppKit
struct MenuView: View {
@State var currentTab = "Enabled"
var body: some View {
VStack{
HStack{
Button(action: {
NSSound.beep()
print("Beep")
}) {
Text("Hello wordl!")
} }
.padding(.horizontal)
.padding(.top)
Spacer(minLength: 0)
}.frame(width: 250, height: 300)
}
}
struct MenuView_Previews: PreviewProvider {
static var previews: some View {
MenuView()
}
}
Thanks in advance