Skip to content

Conversation

acosmicflamingo
Copy link
Contributor

There was lots of discussion in #311 on how to address the issue with PathDelegate being registered as NavigationStackController's super.delegate earlier than expected, so here's a PR that takes @tgrapperon 's changes, adds a purple run-time warning letting users know to set their delegate in the init, and an update to the test that addresses this issue.

@acosmicflamingo acosmicflamingo force-pushed the fix-uinavigationcontrollerdelegate-forwarding-for-real branch 2 times, most recently from 68b8583 to da98da1 Compare October 2, 2025 16:04
@acosmicflamingo
Copy link
Contributor Author

acosmicflamingo commented Oct 2, 2025

Looks like that failure in da98da1 was a false positive. This PR is good for merging then.

Edit: pushed final change to remove random .orig file that appeared.

@acosmicflamingo acosmicflamingo force-pushed the fix-uinavigationcontrollerdelegate-forwarding-for-real branch from 91d4943 to 6883e9b Compare October 2, 2025 20:02
Comment on lines 29 to 36
reportIssue(
"""
UINavigationControllerDelegate object is being set after
NavigationStackController's viewDidLoad() has been called,
so delegate functions will not be observed. Set your delegate
in your subclass's initializer to fix this issue
"""
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this an issue that plagues UIKit in general? Do we really need to report this issue in our library? People should just know that they always need to set their delegates right when the controller is initialized, and never do it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know that 🤣 I was thinking that this could prevent others in the future from creating a ticket in swift-navigation repo. But, I'm happy with whatever decision you make given that I now know what the problem was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I don't think we need to report issues that help people use UIKit correctly. If you revert this we will merge and release the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'll do it later tonight when I'm in front of the keyboard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@acosmicflamingo acosmicflamingo force-pushed the fix-uinavigationcontrollerdelegate-forwarding-for-real branch from 6883e9b to e9a6375 Compare October 7, 2025 01:54
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.

3 participants