My scenario, I am having tabbar
with three viewcontroller
and first tabbar
viewcontroller I am showing tableview
with some data
. Whenever I am clicking the tableview
cell
I am passing the data to one special present model
popupcontroller. If I dismiss
popup controller I need to show directly to tabbar index 1
(I mean tabbar second viewcontroller
) also need to pass the values
.
Here, below code I tried
- After select the tableview cell passing values to popupview controller
- Popup close button click to pass the same value to tabbar index 1 (tabbar second viewcontroller)
Inside popup view controller
var item : Datum! //Datum Codable Root
@IBAction func close_click(_ sender: Any) {
NotificationCenter.default.post(name: Notification.Name(rawValue: "disconnectPaxiSocket"), object: nil)
if let presenter = presentingViewController as? HomeViewController {
presenter.updatitem = item
}
dismiss(animated: true, completion: nil)
}
Once popup dismissed
showing tabbar
first viewcontroller
(index 0), so I added NotificationCenter
to call function and change the index.