SimformSolutionsPvtLtd / SSCustomTabbar

Simple Animated tabbar with native control
MIT License
596 stars 69 forks source link

Unable to set the default chosen tab. #17

Closed KirlosYousef closed 1 year ago

KirlosYousef commented 4 years ago

Hello,

I have been trying to set the default chosen tab view when the app starts but it's not working, Could you please tell me how can I do that? I am using SwiftUI

Thank you.

akhilftech commented 2 years ago

Just add the Below code(In my case selected tab is 2)

override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) self.tabBarController?.selectedIndex = 2 }

vraj-s-shah commented 1 year ago

Hi @KirlosYousef, you can use SSTabConfiguration() to set selected tab while using SwiftUI. Refer to the example given below:

let tabBarView = SwiftUITabBarController(tabItems: [vc1, vc2, vc3, vc4, vc5], configuration: .constant(SSTabConfiguration(selectedIndex = 1)), isTabBarHidden: self.$isTabBarHidden)


Thank you for reaching us out, hope this helps 😊.

mobile-simformsolutions commented 1 year ago

@KirlosYousef Functionality is available in the latest release version 2.0.7.