Perform unwind segue SWIFT5

95 Views Asked by At

I have three viewControllers. First one news list , second Login screen and third is about reading article. If the news is not free I redirect the user to login screen. If user successuly logged in then I'm showing the selected news. But the problem is when user hit back button it return to login screen so I use unwind segue to direct home screen. When I use unwind segue it was working good but one problem is my login screen is still seen about 1 second. So is there a way to hide viewcontroller or make much faster

I detect If the navigation bar back button is clicked.

  override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    
    if self.isMovingFromParent {

       performSegue(withIdentifier: "toHomeScreen", sender: self)


        }
}

then I perform unwind segue.

0

There are 0 best solutions below