swiftunwind-segue

Is there a way to make the destination view controller reload the view after an unwind segue from the source view controller in swift/Xcode?


Is there a way to make the destination view controller reload the view after an unwind segue from the source view controller in swift/Xcode?

i.e. run viewDidLoad() at the destination view controller?? or something similar?


Solution

  • No. It was your job to pass back any needed info during the segue. It is the view controller's job to respond to that info by updating its own interface.

    Let's say we are popping back from VC2 to VC1 with an unwind segue. Then you can implement prepareForSegue in VC2 to hand VC1 any data that it needs, in some method designed for the purpose.

    Or use the standard protocol-and-delegate pattern for communicating data back from VC2 to VC1 while the user is in VC2.