I'm bashing my face against a wall trying to figure out why I can't get the .digitalCrownRotation feature to work on a Text UI Component in SwiftUI for WatchOS.
Here's my code:
import SwiftUI
struct ButtonView: View {
@State private var isFocused = false
@State private var value: Int = 0
var body: some View {
Button(action: {
print("clicked")
}) {
Text("\(value)")
.contentShape(Rectangle())
.focusable { self.isFocused = $0 }
.digitalCrownRotation(self.$value, from: 0, through: 9, by: 1, sensitivity: .medium, isContinuous: true, isHapticFeedbackEnabled: true)
}
.background(self.isFocused ? Color.green : Color.white)
}
}
Everything worked fine up until the pointer where I tried to add the .digitalCrownRotation functionality.
Whenever I try to build I'm faced with the following 2 build fail messages:
Argument type 'Int.Stride' (aka 'Int') does not conform to expected type 'BinaryFloatingPoint' Argument type 'Int' does not conform to expected type 'BinaryFloatingPoint'
I'm basically trying to use the digital crown to step through numbers (integers) from 0 to 9 when the buttons are focused. But it's not working and I'm not sure what to do to resolve it.