Skip to content

Commit

Permalink
Fix: pop-to-root during Sign Out to work around warning
Browse files Browse the repository at this point in the history
- Warning encountered on iOS 18 when signing out:
> The `navigationDestination` modifier only works inside a `NavigationStack` or `NavigationSplitView`. Theres
  • Loading branch information
aokj4ck committed Jan 25, 2025
1 parent 8beb9d9 commit 68517b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion BikeIndex/View/Settings/SettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct SettingsPage: View {
Label("Registration Organization", systemImage: "person.badge.shield.checkmark")
}

Button(action: client.destroySession) {
Button(action: logout) {
Label("Sign out", systemImage: "figure.walk.departure")
.tint(Color.highlightPrimary)
.foregroundStyle(Color.highlightPrimary)
Expand Down Expand Up @@ -171,6 +171,11 @@ struct SettingsPage: View {
}
}

func logout() {
path = NavigationPath()
client.destroySession()
}

/// Excluding signOut and contactUs which don't navigate internally
enum SettingsSelection: Hashable, Identifiable {
var id: Self { self }
Expand Down

0 comments on commit 68517b7

Please sign in to comment.