Demo.swift
ContentView.swift
App.swift
import SwiftUI
struct ResetMultiPushDemo: View {
@State private var path: [Int] = []
var body: some View {
NavigationStack(path: $path) {
VStack(spacing: 12) {
Button("Reset to root") { path.removeAll() }
Button("Go to 1 → 2 → 3") { path.append(contentsOf: [1,2,3]) }
}
.navigationDestination(for: Int.self) { n in Text("Screen #\(n)") }
.navigationTitle("Reset & Multi-Push")
}
}
}
import SwiftUI
struct ContentView: View {
var body: some View { ResetMultiPushDemo() }
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene { WindowGroup { ContentView() } }
}