我发现了一个在watchOS 8.1RC中出现的回归问题,与从TabView触发的NavigationLink有关。 它会立即被关闭。
在watchOS 8.0或模拟器(watchOS 8.0)中可以正常工作。 您知道有没有解决方法吗? 谢谢
示例代码:
import SwiftUI
@main
struct TestNavigationApp: App {
var body: some Scene {
WindowGroup {
NavigationView {
ContentView()
}
}
}
}
struct ContentView: View {
var body: some View {
List {
NavigationLink(destination: ContentView1()) {
Text("To TabView")
}
}
}
}
struct ContentView1: View {
var body: some View {
TabView {
NavigationView {
NavigationLink(destination: ContentView2()) {
Text("To ContentView2")
}
}
VStack {
Text("Screen2")
}
}
}
}
struct ContentView2: View {
var body: some View {
Text("ContentView2")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}