Swift and SwiftUI tutorials for Swift Developers

Customizing the Navigation Bar in SwiftUI

By default, the navigation bar is set to display as a large title. However, if you want to keep the navigation bar compact and disable the use of a large title, you can add the navigationBarTitleDisplayMode modifier just below the navigationTitle modifier like this:

.navigationBarTitleDisplayMode(.inline)

The parameter specifies the appearance of the navigation bar, determining whether it should appear as a large title or compact title. By default, it is set to .automatic, meaning that the large title is used.

In the above code we set it to .inline indicating that a compact bar should be used.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Article

How to use NavigationLink in SwiftUI

Next Article

Customizing the Back Button Image and Color of a Navigation View in SwiftUI

Related Posts