Search code examples
swiftuiswiftui-navigationstack

How to set specific NavigationBar height?


I have a NavigationStack with a custom ToolbarItem in it like this:

Custom NavigationStack

It's working well, but I want to set a specific height for the NavigationBar to make it look better. I don't want to change the .inline modifier for the .navigationBarTitleDisplayMode, only to be able to set the height manually.

This is my code so far:

NavigationStack{
     List{
        Section{
           .....
        }
     }
     .listStyle(.plain)
     .toolbar {
            
            ToolbarItem(placement:.topBarLeading){
                CustomFeedNav()
            }
            
            ToolbarItem (placement: .navigationBarTrailing) {
                Button{
                }label: {
                    Image(systemName: "arrow.counterclockwise.circle")
                }
            }
     }
}

What I'd love to achieve

Unfortunately, I am not sure how to tackle the problem, but I believe it may be related to some UIKit code. Thank you in advance.


Solution

  • Solved my problem by switching from a List to a LazyVStack with a sticky header that functions like a NavigationBar. LazyVStack offers more powerful capabilities compared to List. I highly recommend utilizing it.