0

I have a page where I would like to have a scrollview scroll at constant velocity. This appears very frequently in guitar websites, where the page basically autoscrolls. For example, on this site, you could click where it says "autoscroll", and you could use a slider to adjust the autoscrolling speed. I was wondering if you could do that in UIKit or even better, in SwiftUI. I know there's the ScrollViewReader, but that is mainly used to jump to a location.

It would be great if anyone could give me some kind of guidance on this, Thanks!

Kelvin Jou
  • 271
  • 2
  • 12
  • Probably a better fit for UIScrollView or NSScrollView – jnpdx Dec 27 '22 at 03:01
  • Yes, I was thinking of UIScrollView and then wrap it in a UIViewRepresentable. However, I still do not know how to implement this logic. There seems to be a solution here: https://stackoverflow.com/questions/49974662/how-to-autoscroll-the-scrollview-horizontally but I don't know how to utilize that scheduledTimerWithTimeInterval method – Kelvin Jou Dec 27 '22 at 07:16

1 Answers1

0

scroll.setContentOffset(CGPoint(x: xPos, y: yPos), animated: true)