Skip to content

Enable root view controller replacement in NavigationStackController#339

Open
lucamegh wants to merge 1 commit intopointfreeco:mainfrom
lucamegh:navigationstack-root
Open

Enable root view controller replacement in NavigationStackController#339
lucamegh wants to merge 1 commit intopointfreeco:mainfrom
lucamegh:navigationstack-root

Conversation

@lucamegh
Copy link
Copy Markdown

This change addresses an issue that arises when using NavigationStackController in combination with UISplitViewController.

In my project, I configure the split view's columns at runtime by passing NavigationStackController instances to UISplitViewController.setViewController(_:for:). While this works as expected for primary/secondary/supplementary/inspector columns, it does not behave correctly for the compact column.

On iOS 17 and earlier, the compact column is intended to be configured only once; subsequent attempts to replace it are ignored. As a result, dynamically updating the compact column by swapping out the entire navigation stack is not a viable approach.

If NavigationStackController allowed updating its root view controller instead of requiring replacement of the entire stack, this limitation could be avoided.

I understand that NavigationStackController is modeled after SwiftUI’s NavigationStack. However, NavigationStack provides greater flexibility by accepting a ViewBuilder to construct its root content dynamically.

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.

1 participant