How to Unwind Segue in Swift 3

Last Updated: April 13, 2020

In this post we will see how to unwind the Segue with Swift code

What is Unwind Segue?

unwind segue

You can use Segue to go to 2nd View Controller when you touch the button on 1st View Controller

If you want to come back to the 1st View Controller you can use Unwind Segue

How do you apply unwind segue to Back to 1 button?

Create a outlet for Back to 1 in VC2.swift file and put the following code

 @IBAction func actionBack(_ sender: Any) {
        dismiss(animated: true, completion: nil)