You can access the tab bar controllers in your ViewController prepare method and set your values.
Prepare for segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let barViewControllers = segue.destination as! UITabBarController let destinationViewController = barViewControllers.viewControllers?[0] as! FirstViewController destinationViewController.test = "Hello TabBar 1" // access the second tab bar let secondDes = barViewControllers.viewControllers?[1] as! SecondViewController secondDes.test = "Hello TabBar 2" }
Then in your tab bar ViewControllers declare variables, you want to set the values to.
@IBOutlet weak var label: UILabel! var test: String? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. label.text = test }
FirstViewController

SecondViewController

as! FirstViewControllerthen I won't have access to the variables inViewController, the point is I want to pass data fromViewControllerto the view controller of the tab bar.