Skip to content

Add support for custom navigation title in SwiftUI#134

Closed
ChaosCoder wants to merge 1 commit into
vtourraine:mainfrom
ChaosCoder:customNavigation
Closed

Add support for custom navigation title in SwiftUI#134
ChaosCoder wants to merge 1 commit into
vtourraine:mainfrom
ChaosCoder:customNavigation

Conversation

@ChaosCoder

Copy link
Copy Markdown
Contributor

Currently, it is not possible to override the navigation title of a SwiftUI view. Since it is a struct, we cannot simply inherit from it and override the body.

In this PR, we add the navigationTitle as a property and allow it to be passed via various initializers. Because we pass a default value to navigationTitle in every initializer, the code remains completely backward compatible.

It would be beneficial to have this change for the UIKit variant as well, but there are many places where we would need to pass it. Therefore, I have decided to keep this PR for the SwiftUI world.

@vtourraine

Copy link
Copy Markdown
Owner

Hello Andreas, and thanks for coming back with more suggestions!

This one is interesting, because it’s been requested once. It might have been for the UIKit view controller then, but I would make the same answer: to me, this doesn’t feel like a customization option worth adding. If we start having properties to customise aspects that essentially fall back directly to UIKit/SwiftUI properties, then I wouldn’t know where to stop. Subclassing/forking/etc a custom implementation seems like the right approach here.

Can you share what you want to customise this title with? Maybe it’s more a matter of localization? Something else?

@vtourraine vtourraine closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants