Вы можете запустить приведенный ниже код, чтобы воспроизвести такое поведение. Речь идет о кнопке «Готово».

import SwiftUI
@main
struct NavBarTestApp: App
{
var body: some Scene
{
WindowGroup
{
ContentView()
}
}
}
struct ContentView: View
{
@State private var navigationPath: NavigationPath = NavigationPath()
private func onAction(
_ text: String
)
{
navigationPath.append(text)
}
var body: some View
{
NavigationStack(path: $navigationPath)
{
SomeForm(
text: "Hello World",
onAction: { onAction("Hello World") }
)
.navigationDestination(for: String.self)
{
text in
SomeForm(
text: text,
onAction: { onAction(text) }
)
}
}
}
}
struct SomeForm: View
{
let text : String
let onAction : () -> Void
var body: some View
{
Form
{
Section
{
Button(action: { onAction() })
{
Text(text)
}
}
}
.navigationTitle("Title")
.navigationBarTitleDisplayMode(.inline)
.toolbar
{
ToolbarItem(placement: .topBarTrailing)
{
Button(action: { })
{
Text("Done")
.bold()
}
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... navigation
Мобильная версия