( i require a present vc not push vc )
I have a tabbar and a navigation controller interface
my first tab bar item vc1 and second tab bar item is vc2
push vc works fine this is what i did Step 1- I click on a button in vc1 which navigates me to vc3 via navigational push
Next i clicked on vc2 tab item then i click on vc1 tab item and then i press BACK button of vc3 what i get is a correct flow of app
backbutton does pop viewcontroller
fileprivate func presentDetail(at indexPath: IndexPath) {
self.updateCell(at: indexPath)
self.startLoading()
let vc3 = storyboard?.instantiateViewController(withIdentifier: "vc3") as! vc3
// self.navigationController?.setViewControllers([vc,vc1], animated: true)
vc3.modalPresentationStyle = .overCurrentContext
vc3.data = mDataSource.shared.demoData[indexPath.row]
if let navigator = navigationController {
navigator.pushViewController(vc3, animated: true)
}
@IBAction func backBtnTapped(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
// performSegue(withIdentifier: "unwindSegueToVC1", sender: self)
}
how to make present VC work?
let vc = storyboard.instantiateViewController(withIdentifier: "vc3") as! vc3
vc3.modalPresentationStyle = .overCurrentContext
vc3.data = mDataSource.shared.demoData[indexPath.row]
self.present(vc, animated: true, completion: nil)