Hey folks,
I need to implement a view for a live activity (so using. WidgetKit), so any UIKit/SceneKit is a non-starter.
The thing to implement is a horizontal representation of a 360 degree protractor ('degree triangle').
I would like this view to be inifintely scrollable as if the user has a circular shape around their head and they can rotate their head to look at all the numbers, and when they reach 360/0, they simply continue with new round. In both directions.
I've managed to get this working for the positive values by using a LazyHStack and which is populated using ForEach
, using a custom class that implements RandomAccessCollection
where the endIndex
is Int.max (not truly infinite, but good enough).
However, I can't get the scrollview/ForEach to start in the 'center' of the Int.max range (I'm sure this would cause some performance issue as well).
So my question is: how to get a SwiftUI scrollview to behave like a infinite scrollview, pretty much like Josh Shaffer explained in WWDC 2011 in the session with Eliza Block called 'Advanced ScrollView Techniques'?