Purpose of tabBarItem in UIViewController


I have a question about the organization of the tab bar item. Why does it live in the UIViewControlle? Presumably most view controllers aren’t in a UITabBarController. Semantically, wouldn’t it make more sense for a UITabBarController to have a collection of UITabBarItems corresponding to its child controllers? In the future, if Apple adds other view navigators like UITabBarController (for the sake of example let’s call it UIViewSwitcherController), would they need to add a viewSwitcherItem instance variable to the UIViewController?

I understand how the existing paradigm works, I just don’t get why it would be arranged this way. I’m hoping someone can shed some light on it.


Well, you may want to change the title/image of the tab bar item because of something that is happening. In your setup, who would do that? How would you get a message there?

Another situation is what happens if you start with four view controllers in a tab bar, and later you insert a a fifth one in the 2nd position. Now you have two data structures to update.