I have a simple SwiftUI view running on WatchOS. It contains a list of Text Fields in a ScrollView that is longer than the height of the Screen.
I would like the Digital Crown to AUTOMATICALLY by usable to Scroll the view immediately it appears. This is supposed to be the default behavior of Digital Crown on WatchOS.
However, when it appears the view is only scrollable using up/down swipe gestures. Once a "manual" scroll has been done (using finger) only THEN is the DigitalCrown "attached" and it can then (after "manual" scroll) be used to Scroll the view.
How do I "attach" the View to the DigitalCrown (for scrolling) IMMEDIATELY it appears (ie: without the need to do a manuaL scroll first)?
The code is below. I have already tried to "attach" (move) the:
.focusable(true)
.digitalCrownRotation($scrollAmount)
attributes to the Outer VStack and the last Text field before the if statement but no matter where I place the above two lines (or even if I remove them!), the behavior is always the same.
struct aboutView: View {
@EnvironmentObject var BLEinfo: BLEdata
@State private var scrollAmount = 1.0
var body: some View {
VStack {
Text("About")
.font(.system(size: CGFloat(self.BLEinfo.nonDynamicUIfontSize)))
.fontWeight(.semibold )
.padding(.top)
.focusable(false)
Divider()
ScrollView {
VStack {
Text("Sensor Inventor & Patents:")
.fixedSize()
Text("The Good Dr.")
.fontWeight(.semibold)
.fixedSize()
Text("Apple & Android Apps:")
.fixedSize()
.padding(.top)
Text("That's me..")
.fontWeight(.semibold)
.fixedSize()
Text("Integrated Hardware:")
.fixedSize()
.padding(.top)
Text("Jeff X")
.fontWeight(.semibold)
.fixedSize()
.padding(.bottom)
.focusable(true)
Text("This app version: ")
+ Text(self.BLEinfo.thisAppVersion)
.fontWeight(.semibold)
Text("Last Connected Device: ")
.padding(.top)
Text(self.BLEinfo.lastConnectedNameSaved)
.fontWeight(.semibold)
if !self.BLEinfo.lastConnectedNameSaved.contains("") {
Text(self.BLEinfo.swVersionMtr)
.fontWeight(.semibold)
if !self.BLEinfo.firmwareVersionOK {
Text("New Mtr FW Available\nPlease UPDATE ASAP!")
}
}
}
}.digitalCrownRotation($scrollAmount)
}.font(.system(size: CGFloat(self.BLEinfo.nonDynamicUIfontSize) - 2))
.padding(.horizontal)
.navigationBarTitle("Scanning...")
}
}