Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SwiftUI modifier for easily tracking navigation between views #199

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

Jeehut
Copy link
Contributor

@Jeehut Jeehut commented Nov 3, 2024

Most flexible "core" solution for #184.

Note that I considered but decided against the following names:

  • .navigationPathChanged(to:) while being consistent with the extension function on TelemetryDeck, it's very uncommon for SwiftUI modifiers to state something like "changed" when nothing in the view hierarchy actually changed.
  • .onNavigationPathChange() would be more SwiftUI-like, but how to pass the path in a natural wording? Doesn't seem perfect either.
  • .reportNavigation(path:) seemed a good, but I liked track better because it's more commonly associated with Analytics.
  • .signalNavigation(path:) is consistent with the signal method, but while I find TelemetryDeck.signal clear thanks to the TelemetryDeck context, in a SwiftUI view it seems a bit unclear.

For these reasons, I decided for trackNavigation(path:) which is clear and short and consistent with SwiftUI-naming.

Copy link
Contributor

@winsmith winsmith left a comment

Choose a reason for hiding this comment

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

Simply lovely!

@Jeehut Jeehut merged commit 28052e7 into main Nov 4, 2024
6 checks passed
@Jeehut Jeehut deleted the feature/navigation-modifier branch November 4, 2024 16:50
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