0

I have an app with an UITabBarController, the tabs navigate as usual, but one of the tabs should navigate to different view controllers depending on the project target, everything is laid out with storyboards.

Can not seem to find a way without doing some logic when loading one of the view controllers, and that seems ugly and unscalable.

Any advice is welcome.

Juan Boero
  • 6,281
  • 1
  • 44
  • 62
  • 1
    What about [this](http://www.appcoda.com/using-xcode-targets/)? – Ryan Dec 06 '16 at 18:51
  • @Ryan that was nice but could not find anything related to the fact of touching a tab bar item to navigate, and navigate to different places depending on the target. – Juan Boero Dec 22 '16 at 21:19

1 Answers1

0

If you have separate plists for each target you can just add a custom variable that you read via the main bundle info dictionary

plist:

<key>NavigationType</key>
<string>Type1</string>

swift:

guard let navigationType = Bundle.main.infoDictionary?["NavigationType"] as? String else {
  fatalError("Could not find navigation type in the plist")
}
switch navigationType {
case "Type1":
    // do something
case "Type2":
    // do another thing
    ....
pixelrevision
  • 364
  • 3
  • 12