Search code examples
iosiphoneuitabbarcontrollerrss-reader

iOS RSS Feed App: Should I create one class for each view controller?


I am learning how to make an RSS Feeder App with multiple tabs. Each tab leads to a different navigation controller and then table view controller. The only difference between each tab is the RSS URL.

My question is: Do I make a new class from each tab? Or can I just use one MasterViewController class and change the URL depending on the selected tab?

If the latter is true, can I do a switch on self.tabBarController.selectedIndex so I can change the RSS URL based on the selected tab?

What's the best practice here?


Solution

  • Depending on how much functionality is shared between the different tabs/rss feeds you could create one parent viewController with the common functionality and then create derived viewControllers (subclass of the parent viewController) with a separate URL and as needed modifications for each tab.