Reading time: 1 min

This quick recipe shows how to scroll a SwiftUI ScrollView programatically when the scrolling trigger is not wrapped in a ScrollViewReader. E.g, the image below shows scrolling triggered from navigation bar buttons.

Continue Reading...

Reading time: 2 min

This recipe shows how to combine ScrollViewReader and onChange(of:perform:) to jump to the selected item in a scrollable view. We'll use this method to update our top tabs and make them fully visible when selected.

Continue Reading...

Reading time: 1 min

This recipe is about how to scroll a SwiftUI ScrollView programatically. Here's a quick breakdown of what to do:

  • For iOS 13 - tough luck - it can't be done. For whatever reason, this is one of things that were deemed less important for the initial release of SwiftUI.
  • For iOS 14 and above - embed your ScrollView's root view in a ScrollViewReader, and then use the scrollTo method.

Continue Reading...