Hello,
My app worked perfectly using Xcode 15.4. After updating to Xcode 16, my NavigationStack started to present the same screen twice using the following code:
@EnvironmentObject private var pathSports: NavigationRouteManager
var body: some View {
NavigationStack(path: $pathSports.path) {
....
}
.environmentObject(pathSports)
}
NavigationRouteManager:
import Foundation
import SwiftUI
class NavigationRouteManager: ObservableObject {
@Published var path = NavigationPath()
func jumpToRootView() {
path = NavigationPath()
}
}
I have had to change it to the following code for just a single screen to be displayed.
@State private var pathSports: NavigationPath = NavigationPath()
var body: some View {
NavigationStack(path: $pathSports) {
....
}
}
Have others experienced this same problem, or is it just me?
Many thanks.