1

I am having a problem similar to this:

Cannot Get Unwind Segue Working with Modal View Controller Presented Over Current Context

I presented a VC modally using OverCurrentContext presentation style following a tutorial. All set in storyboard.

VC1 -> modally overCurrentContext -> VC2

The problem is that Xcode 8 has slightly different options in the Attributes Inspector, no OverCurrentContext option in the Segue, so I had to select the presentation: default in the Segue

enter image description here

and set the presentation: overCurrentContext in the VC2

enter image description here

Now, when I try to unwind back to the VC1 I can't, nothing happens and I get stuck in VC2.

I had to add some extra code to the unwind method to make this work.

@IBAction func unwindFromAdvancedOptions(segue: UIStoryboardSegue) {

    if segue.source as? VC2 != nil {
        segue.source.dismiss(animated: true, completion: nil)
    }
}

But I'd really like to understand why storyboard settings where enough to unwind any other modal presentation styles but OverCurrentContext.

Community
  • 1
  • 1
sylvia
  • 65
  • 5
  • I may be wrong on this, but I had a problem with it a while back, and found a way around it, then recently I wanted it to unwind again, and this time it worked. I would try updating to the newest version of Xcode and seeing if that helps anything. – Sethmr Mar 01 '17 at 17:24
  • Thanks for the fast response @Sethmr. I am using the last version (8.2.1) already. – sylvia Mar 01 '17 at 17:29
  • Having the same problem. Took forever to realize the source of it. Trying to get your workaround to work -- appreciate the lead. Did you ever get more clarity on why Swift works this way? – ConfusionTowers Sep 01 '17 at 18:17

0 Answers0