What new additions to the SwiftUI scroll view will there be in iOS18?

Asked on 08/02/2024

1 search

In iOS 18, SwiftUI introduces several new additions to the scroll view, enhancing both functionality and control. Here are the key updates:

  1. Programmatic Control: You now have more programmatic control over your scroll view, including the ability to programmatically scroll to various positions like the top edge.
  2. Scroll Positions: There are more scroll positions available for programmatic scrolling.
  3. Scroll Geometry Changes: The onScrollGeometryChange modifier allows you to react to changes in content offsets, content size, and more, enabling deeper integration with the state of a scroll view.
  4. Visibility Detection: You can detect when a view's visibility changes due to scrolling, which is useful for creating experiences centered around content moving on or off screen.
  5. Content Alignment: You have more control over content alignment within the scroll view.
  6. Bouncing Control: You can turn off bouncing along a given axis.
  7. Stopping Scrolling: There is the ability to programmatically stop scrolling.

For more details, you can refer to the session What’s new in SwiftUI (16:47).