Nazmul Hasan Nazmul Hasan - 1 year ago 91
iOS Question

Passing data with segue through TabBarControllerController

Try this one Passing data with segue through navigationController but I need one more step before


enter image description here


The destination view controller of the segue is the
. How can I get the real destination

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == segueIdentifire() {
let dcTabBar = segue.destination as! UITabBarController
let dcNabBar = //i don't know what should i write here?
let dc = dcNabBar.topViewController as! RestaurantTableViewController
dc.dcTitle = "Restaurant"


Answer Source

You can get the vc with dcTabBar.viewControllers?[0] (replace 0 with index) or just dcTabBar.selectedViewController if its the first tabbar item

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download