Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • After some tests finally found out what was the problem: you added a VStack(alignment: .leading) inside the navigationHeader. That fixed the problem on the second image of my question. Plus you added the change of frame, thank you so much. I'm going to try to add a transition animation between the navigation bar views, but you saved my life already. What I didn't figured it out, is that I don't see the orange frame growing down you when one scrolls down. Also it seems the stickyness is not working when scrolling a bit up (before changing to the inline navigationbar view). Commented Jul 15, 2022 at 10:27
  • Yes, I commented the VStack in the code but forgot to write in the answer :) I did try a quick animation/transition test but didn't get it to work fast enough so I skipped it. Good look with it, might be interesting how you solve it. Commented Jul 15, 2022 at 10:35
  • for the stickiness ... it does work with me (Xcode 14b, iOS 16), my posted code should reproduce that ...? I did change the min and max heights, maybe that? Commented Jul 15, 2022 at 10:36
  • 1
    no, I did a copy mistake ... there is a .frame(maxHeight: .infinity) missing in header view, I'll correct it in the answer. Commented Jul 15, 2022 at 10:48
  • 1
    Yup that .frame(maxHeight: .infinity) fixes the growing down. Also I fixed that stickyness problem. The calculateHeight the return maxHeight + yOffset should be replaced with just return maxHeight. I'm going to correct the code in the question. Commented Jul 15, 2022 at 11:01