add NavigationManager for programatic navigation from the root

This commit is contained in:
Felix Förtsch
2024-11-04 14:43:47 +01:00
parent c722d59aff
commit 19b3d89010
6 changed files with 73 additions and 12 deletions

View File

@@ -0,0 +1,26 @@
//
// NavigationManager.swift
// WorkoutsPlus
//
// Created by Felix Förtsch on 04.11.24.
//
import SwiftUI
class NavigationManager: ObservableObject {
@Published var path = NavigationPath()
func navigateFromRoot(to destination: NavigationDestination) {
path = NavigationPath()
path.append(destination)
}
}
enum NavigationDestination: Hashable {
case activeWorkoutSession
case workoutLibrary
case workoutLog
case exerciseLibrary
case settings
case debug
}