Is there no way to scroll to a Scroll Offset programmatically in SwiftUI? (not to a ID)
#swiftui #iosdev #macosdev
@obrhoff iOS 18 added a whole pile of new scroll-related API, including this, which might do what you need: https://developer.apple.com/documentation/swiftui/view/scrollposition(_:anchor:)
scrollPosition(_:anchor:) | Apple Developer Documentation

Associates a binding to a scroll position with a scroll view within this view.

Apple Developer Documentation

@sfko I'm using something like this right now, but I would like to have something offset-based.

It’s mostly since I got a “restore” mechanic when you leave a screen and come back (the screen deallocs completely and only a State is saved in custom NavigationStack), and I would like to apply the last saved offset.

It works well for screens that use my custom CollectionView Wrapper, but with this API, you are never that precise.

@obrhoff did I misread the docs, or am I misunderstanding your need? It looked to me like that API provides a binding to both read and set a concrete offset (as well as IDs).