I just started learning swift today and Im trying to create a stopwatch app that'll allow you to click one of the physical buttons on the watch and not the screen for an easier timing experience. I read a few things saying that apple doesn't allow the digital crown to be manipulated within your code but is it the same for the side button as well?
Any help would be greatly appreciated thanks.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
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.
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!