Post

Replies

Boosts

Views

Activity

ScrollViewReader initial position with toolbar on WatchOS
I have a simple list with a toolbar. I'd like to hide the toolbar on first appear. If I'm adding scrollTo inside the list's onAppear, it gets called before list items are initialized. onAppear of ForEach gets called for an each item. It's easy to bypass it by adding Dispatch.async (is there better way?), but here comes main problem: scrollTo(0, anchor: .top) doesn't hide the toolbar. It looks like a bug - if I scroll to the bottom by hand and then call scrollTo(0, anchor: .top) - it'll show the first item without the toolbar. So if I scroll programmatically to the second item, and then wait two more Dispatch.asyncs - the problem is solved 🤦‍♂️ And from watching the WWDC session - https://developer.apple.com/videos/play/wwdc2020/10171/ (starting from 12:25) it sounds like this toolbar shouldn't appear in the first place, and should only appear when user scrolls to it, so am I doing something wrong? Sadly I don't have apple watches and I can't check out Messages behaviour, so if you can let me know in the comment please. }
0
0
1.1k
Mar ’21