writefreely/writefreely-swiftui-multiplatform

On launch, the editor should animate into view

Closed this issue · 1 comments

Setting the selectedPost on launch to either the last draft or a new blank post should be wrapped in DispatchQueue.main.async {}, and this will animate things in properly, but intermittently dumps you back out into the post list (unsetting the last draft value at the same time) with a console message about

Unbalanced calls to begin/end appearance transitions for DestinationHostingController

This suggests that the app is trying to present the same view twice, at the same time.

Huh, it looks like the GeometryReader we're using in the PostListView for iOS is what's causing this "unbalanced calls" warning. We use this to set the width of the bottom bar of the PostListView (setting button, number of posts, and refresh button), and it seems like it has to first read the size of the frame, then invalidate and rebuild the view to apply the frame width to the bottom bar, and that seems to be kicking state down the line (or rather, up the hierarchy) and re-triggering the setting of selectedPost.