I have a problem when navigating to the details page, but when I try to open another application or close the application, the navigation link that was initially active suddenly closes by itself. Whereas in the past when 2021 to early 2023 there was no such problem, I am suspicious of the iOS version update.
I set the minimum iOS 14 version for my target app. But from the whole complex code I have, here I will only share the sample code that I am currently using.
I use the following code:
import SwiftUI
struct ContentView: View {
init() {}
var body: some View {
NavigationView {
TabView {
VStack {
NavigationLink {
Text(“Detail Home Page”)
.foregroundColor(.blue)
} label: {
Image(systemName: “globe”)
.foregroundColor(.red)
Text(“Home Page”)
.foregroundColor(.red)
}
}
.tabItem {
Label(“HOME”, image: “home”)
}
}
.accentColor(.white)
}
}
}
I know there is another way to solve this using the code below, but the TabBar/TabView does not disappear when navigating.
TabView {
NavigationView {
VStack {
NavigationLink {
Text(“Detail Home Page”)
.foregroundColor(.blue)
} label: {
Image(systemName: “globe”)
.foregroundColor(.red)
Text(“Home Page”)
.foregroundColor(.red)
}
}
}
.tabItem {
Label(“HOME”, image: “home”)
}
}
.accentColor(.white)
Do you have any suggestions for me? Please help