I have a controlled Tab view like this
TabView(selection: $activeTab) {
IntroductionView().tag(1)
HomeView().tag(2)
SettingsView().tag(3)
ProfileView().tag(4)
}
I want to add transition to each of the views when activeTab
changes, say simple cross fade of opacity?
Tried something along the lines of
TabView(selection: $activeTab) {
IntroductionView().tag(1).transition(.opacity)
HomeView().tag(2).transition(.opacity)
SettingsView().tag(3).transition(.opacity)
ProfileView().tag(4).transition(.opacity)
}
.animation(.smooth, value: activeTab)
But this seems to have no effect. There are some answers like this one that add some kind of scrollable / slide animation via .tabViewStyle(.page(indexDisplayMode: .never))
modifier, but that’s not exactly what I’m after.
Perhaps there is a way to utilize / extend UIKit to add a cross fade transition?