8 Replies
      Latest reply on Jan 18, 2020 12:49 PM by Jim Dovey
      Jaanus Level 1 Level 1 (0 points)

        Just getting started with SwiftUI. Exciting stuff.


        I understand that List would be one of the main building blocks that I can use in place of UI/NSTableView. One thing I haven’t seen yet: how to get and set the scroll position? Specifically, my list would consist of “read” and “unread” items. When the user first enters the list, everything is unread, so the list can start at the top. As new items scroll into view, they become “read”. When the user now leaves the list, and later returns, the list should scroll to the first “unread” item. So I am not so much interested in the pixel-level scroll offset, but rather, how do I scroll the viewport into the right location so that the user would see the desired info. The API could be something like “scroll the list such that model object X is visible in the middle” (with or without animation).


        The read/unread state is easily expressible as a model object property. I’m having trouble with how to bind it to the list scrolling in this new declarative world of ours.