I'm trying to code a variable stride value for my digitalcrownrotation but can't get it to work. In this example here I'm using a conditional value in the "by" parameter: self.counterValue < 10.0 ? 1 : 20. Any idea what I'm doing wrong ?
struct AdjustTimeView: View {
@State private var counterValue: Double = 1.0
var body: some View {
VStack {
ZStack {
Clockface()
VStack {
Text("\(Int(counterValue))")
.font(.headline)
.fontWeight(.medium)
.foregroundColor(Color("MyBlueColor"))
.multilineTextAlignment(.center)
.focusable(true)
.digitalCrownRotation(self.$counterValue, from: 1.0, through: 180.0, by: self.counterValue < 10.0 ? 1 : 20, sensitivity: .medium, isContinuous: false, isHapticFeedbackEnabled: true)
Text("min")
.font(.footnote)
}
}
}
.navigationBarTitle("Adjust time")
}
}