Dominik
Dominik

Reputation: 419

How to launch Viewcontroller seperate in TabBar Controller

i created an Swift project with an Tab Bar navigation. Following i added an Tab Bar controller to my storyboard an connect all Viewcontroller with that. Now something seems pretty strange. If one of both ViewController cant get any data the other Viewcontroller is slow as well. There is no connection between both. So is there a way to solve this problem?my Storyboard

Find attached my Storyboard:

Upvotes: 0

Views: 42

Answers (1)

matt
matt

Reputation: 535999

If one of both ViewController cant get any data the other Viewcontroller is slow as well. There is no connection between both

The thing about a tab bar controller is that it instantiates all its children simultaneously. Thus, you have a navigation controller and its child, and a table view controller, and they both come into existence at once. So if one of them slows down the interface, it slows down the interface of the other one.

The solution here is don't slow down the interface. It sounds like you are doing something very wrong (perhaps in the viewDidLoad of your view controllers?), such as networking or doing heavy calculations on the main thread. Don't. Get all of that work off into a background thread so that it doesn't slow things down. This can be quite tricky; for example, gathering the data for a table view over the network is a hard problem, because you have to show the table, get the data in the background, and then populate the table on the main thread. But that's what you have to do.

Upvotes: 1

Related Questions