Im trying to create a program that starts and stops a stopwatch by tracking the rotations of the digital crown, but i'm not sure how to use the crown method in the implementation.
Im kind of a noob to swift so I don't understand how I can track the rotations and use that as a condition for starting and stopping the watch.
My goal is to start the watch any time the rotation is less than 0 or greater than 0 depending on which way the user has spun the crown, and then reset the number to 0.
Then I want to make it so that if the state of the clock is true (so it is running) and the crown rotations become greater than or less than 0, then to stop the timer.
this is the code i saw relating to tracking the rotations of the crown.
sorry if this was confusing, but any help would be greatly appreciated!
Im kind of a noob to swift so I don't understand how I can track the rotations and use that as a condition for starting and stopping the watch.
My goal is to start the watch any time the rotation is less than 0 or greater than 0 depending on which way the user has spun the crown, and then reset the number to 0.
Then I want to make it so that if the state of the clock is true (so it is running) and the crown rotations become greater than or less than 0, then to stop the timer.
this is the code i saw relating to tracking the rotations of the crown.
Code Block struct DigitalCrown: View { @State private var crownValue = 0.0 var body: some View { Text("Received Value:\(crownValue, specifier: "%.1f")") .focusable() .digitalCrownRotation($crownValue) } }
sorry if this was confusing, but any help would be greatly appreciated!