How would I go about dismissing a view controller once a segue has been performed? Once the new view controller has animated on top, I want to dismiss the view controller underneath (the one which the segue was initially triggered from).
I tried the following code but I am getting issues with views not being in the heirarchy.
@IBAction func gotoSection1(_ sender: AnyObject) {
let presentingViewController: UIViewController! = self.presentingViewController
self.dismiss(animated: false) {
presentingViewController.dismiss(animated: false, completion: nil)
}
}
Any help would be greatly apprceiated.