Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI flashScrollIndicators

In UIKit we have a UIScrollView method which allows us to make the scroll indicators flash briefly to inform users there's a scrolling content on screen (which is not always obvious). Apple says:

func flashScrollIndicators()

You should call this method whenever you bring the scroll view to front.

My question is: how can I get the same on SwiftUI? Take a look at this very silly example, just to show the issue:

If you take a look at this screen you can't know if you can scroll something or not:

enter image description here

but you actually could:

enter image description here

How can I make my users aware of scrolling content on SwiftUI?

like image 927
matteopuc Avatar asked May 27 '26 23:05

matteopuc


1 Answers

As of iOS 17.0, there is now:

func scrollIndicatorsFlash(onAppear: Bool) -> some View

to flash the scroll indicators when the view appears. There's also a version with a trigger parameter that flashes the indicators when a value changes.

like image 103
Gorm Avatar answered May 30 '26 15:05

Gorm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!