Roshan Sah
Roshan Sah

Reputation: 137

Whats the difference between moving between Storyboard scenes - Segues and Unwind

I'm a fresher. I used segue to go (Flow of Execution) such like that

 UIViewController A => UIViewController B => UIViewController C.

And used unwind segue to move from C to A. But I am confused about how they different of each other. And Why I use unwind segue although I have delegation.

Thank You in advance.

Upvotes: 2

Views: 74

Answers (2)

Midhun MP
Midhun MP

Reputation: 107231

Segues are for presenting a new view controller.

Unwind Segue is a special kind of segue (A go back mechanism) which moves back to the connected destination.

A->B->C->A

If you are using segue for above mentioned flow, there will be two different instance of A in the memory.

If you use unwind segue for the C->A transition

  1. It act as a go back mechanism and it removes the C and B instance from the memory once the segue is over
  2. There will be only 1 instance of A

Upvotes: 1

iVarun
iVarun

Reputation: 6631

Regular Segue allows us to send data from one view controller to another, but it’s not easy to bring data back if the user has changed or added details in that view controller. That’s where an Unwind Segue comes in.

Read more here

Upvotes: 1

Related Questions