I have a SwiftUI View called MyWatchView with this stack:
VStack (alignment: .center)
{
HStack
{
Toggle(isOn: $play)
{
Text("")
}
.padding(.trailing, 30.0)
.hueRotation(Angle.degrees(45))
if play
{
MyWatchView.self.playSound()
}
}
}
It also has @State private var play = false
and a function playSound
like this:
static private func playSound()
{
WKInterfaceDevice.current().play(.failure)
}
I am getting an error of Type '()' cannot conform to 'View'; only struct/enum/class types can conform to protocols
I think this is probably something that I am not understanding in the way structs work in Swift.