5

I'm trying to create a TabView Slider in SwiftUI with 3 modals that will onboard a user. The default PageTabViewStyle() is a little basic and I'm wanting it to animate with the default slide speed etc.

I've tried appending animation along with the transition from what I've seen online including StackOverflow but it doesn't work.

Here's what I currently have:

ZStack {
        Color.black
        TabView(selection: $currentTab) {
                ForEach(OnboardingData.list) { viewData in
                    OnboardingModal(data: viewData)
                        .tag(viewData.id)
                }
           }
            .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
            .animation(.easeInOut)
            .transition(.slide)
    }
832049823
  • 91
  • 6
  • 2
    Whatever calls that view, or displays it, should be surrounded with `withAnimation { callView() }` – xTwisteDx Apr 23 '21 at 15:40
  • 1
    From what I've seen you cannot customize the animation/transition using `PageTabViewStyle` on SwiftUI as of iOS 14 (I haven't tried on 15) – Luis Ascorbe Aug 16 '21 at 11:09
  • @LuisAscorbe is correct, customization also doesn't work on iOS15. – Patrick Nov 28 '21 at 09:22
  • 1
    Duplicate of [SwiftUI: How to animate a TabView selection?](https://stackoverflow.com/questions/61827496/swiftui-how-to-animate-a-tabview-selection) – Patrick Nov 28 '21 at 09:22

0 Answers0