My Scenario, I have three ViewControllers, those ViewControllers First, Second, Third. Here, First ViewController UIButton click to present model second ViewController and then Second ViewController UIButton click to present model Third ViewController. I need to Implement the Second ViewController button click to dismiss current ViewController after presenting Third ViewController because once I close Third ViewController I need to show First ViewController. How to Achieve this?
NOTE: I am having NavigationController for Third ViewController also I am using Storyboard.
Here's my code:
@IBAction func ClickThirdVC(_ sender: Any) {
    if let VC_Third = self.storyboard?.instantiateViewController(withIdentifier: "thirdviewcontroller") as? ThirdvViewController {
        weak var pvc = self.presentingViewController
        VC_B.modalTransitionStyle = .crossDissolve
        let navController = UINavigationController(rootViewController: VC_B)
        self.dismiss(animated: true, completion: {
            pvc?.present(navController, animated: true, completion: nil)
        })
    }
}
 
     
    