My scenario, I am having Tabbar
with three viewcontroller
. Here, tabbar first viewcontroller
I am showing tableview
. If I click the tableview cell it will show one popup present model viewcontroller. In this present popup viewcontroller
I am maintaining two bar button cancel and done. If I click done It will dismiss and show tabbar
main view controller. While dismiss
time I need to pass some values with button flag from present popup view controller to tabbar main viewcontroller.
Here, below my dismiss popup
pass viewcontroller code (VC 2)
@IBAction func apply_click(_ sender: Any) {
print("Dimiss Filter")
dismiss(animated: true, completion: {
if let navView = self.tabBar?.viewControllers?[0] as? UINavigationController {
if let secondTab = navView.viewControllers[0] as? HomeViewController {
secondTab.selectedIndexFromFirstTab = self.selectedIndex
//secondTab.item = self.item
secondTab.tfData = "YES"
}
}
self.tabBar?.selectedIndex = 0
})
}
Here, Tabbar
main view controller code
(receiving values) (VC 1)
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("SELECTED INDEX:\(selectedIndexFromFirstTab)")
print("RESPONSE:\(tfData)")
}
I am not receiving values, how to solve this issue.