I have two viewControllers "FirstViewController"&"SecondViewControler" that contain a button that presents a new viewController called "BibliothequesViewController" when a button is clicked:
@IBAction func onLibrariesButtonClicked(_ sender: Any) {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc: BibliothequesViewController = storyboard.instantiateViewController(withIdentifier: "BibliothequesViewController") as! BibliothequesViewController
self.present(vc, animated: true, completion: nil)
}
For the time being, the BibliothequesViewController contains a button that's redirects to the FirstViewController with a Segue:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
print("SegWay being performed")
// Every segway has a beginning point and ending point
// We're trying to access the ending point
// as type FullScreenMovieController
// Then we're setting the chosenMovie variable of FullScreenMovieController to 1
let vc = segue.destination as! FirstViewController
vc.receivedSelectedLibraryFromBibliothequesList = self.selectedLibrary
print("vc.receivedSelectedLibraryFromBibliothequesList :", vc.receivedSelectedLibraryFromBibliothequesList )
}
This is the code that performs the Segue:
self.performSegue(withIdentifier: "BiblioToLoginSegue", sender: self)
What I need to implement is:
Redirect to the view (FirstViewController or SecondViewControler) that actually presented BibliothequesViewController.
The code above automatically redirects to FirstViewController whether it was the one that presented BibliothequesViewController or not.
I don't see which approach should I follow to implement this. Should I use push instead of present in the FirstViewController&SecondViewControler?