I have a ContentView as below:
struct ContentView: View {
var body: some View {
TabView {
ReceivedView()
.onAppear {
print("onAppear")
}
SentView()
.onAppear {
print("onAppear")
}
AccountView()
.onAppear {
print("onAppear")
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
}
}
After running the ContentView code, it is shown that views inside TabView is recreated as long as the user scrolls and the prints indicated in the console logs are as below:
onAppear
onAppear
onAppear
onAppear
onAppear
onAppear
Beside these informations, my views in TabView must not be supposed to be recreated in each scroll. Is there a way to prevent TabView from recreating the each view again and again in each scroll movement?