0

I am novice in swift and I have found different tutorials with different solutions. My question is, if I create tab bar menu, I will get in storyboard three views: First Scene, Second Scene and Tab Bar Controller Scene. I understand that I need seperate swift files(classes) for First and Second scene. But in some tutorials people make also next swift file(class) for Tab Bar Controller Scene. Could someone tell me if I need it? If so, why? I have made my app without class for Tab Bar Controller Scene and everything works.

user3421673
  • 97
  • 1
  • 3
  • 10

1 Answers1

1

It is for controlling tabbar delegate or otheres and subview’s. I recommend you make a class file for tabbar too. As you said it works without tabbar class file. But if you deal with complated source you will know that you will need the tabbar class file.

User18474728
  • 363
  • 2
  • 11
  • thank you, could you give me some simple example, when I need this? – user3421673 Oct 12 '18 at 08:35
  • For example, if you want to do some thing with pressed/not pressed tabbar item you can do it in tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { ...some code ...if(tabBarController.selectedIndex == 0 ) { some code} } like this way. sorry for leave a comment with obj c. – User18474728 Oct 12 '18 at 08:45