0

I have a TabBarController with 4 tabs. When the second tab is selected I would like to make an api call to get data & then, once the data returns, display the data in the destination view controller (let's call it SecondViewController).

I believe what I should do is wire up the SecondViewController to the TabBarController with a 'show' segue in the storyboard. However, it seems that I have to wire the TabBarController to the SecondViewController with a 'relationship segue' in-order to have the tab icon displaying. So I have both wired up.

When the second tab is selected the SecondViewController is immediately displayed before the necessary data is returned. Any thoughts on how to address this issue?

I have googled around for hours and have not found any helpful advice. A somewhat relevant stackoverflow question I have found is Prepare for Segue

Hokie2014
  • 35
  • 1
  • 8

1 Answers1

0

Sorry what you want is not possible in iOS.

You can do one thing initially put relationship to a blank page. When you get the response from API you can reset the page. You can programatically replace your blank page with SecondViewController.

OR

You can do one thing initially put relationship to a SecondViewController page with no data. When you get the response from API you can reset the page.

Rahul Dasgupta
  • 894
  • 6
  • 18