0

My app has three screens: an Intro, a Main, and Calculator. Calculator is presented modally from Main. When dismissing Calculator, I want to return to Main. Instead, Calculator is dismissed and then Main is also dismissed automatically, returning the user to Intro.

I've tried using different presentation types and changing the Intro view controller to have a custom class (it originally used the same type as Main).

This is my exit function in Calculator:

@IBAction func exitCalculator(_ sender: Any) {
        self.dismiss(animated: true, completion: nil)
    }

I'm hoping to use the exit function to dismiss Calculator but not Main. I've attached a screenshot of the interface builder to show the organization of the screens.

Interface Builder Screenshot

Jesse
  • 25
  • 7
  • How is Main shown from Intro? Do you have any code in Main that dismisses itself that might be getting called when Calculator is dismissed? – rmaddy Apr 06 '19 at 17:43
  • Did you assign the correct class to MAIN or Calculator in IB – E.Coms Apr 06 '19 at 17:51
  • @rmaddy On a button click, Intro presents Main with a "show" action segue. I set it up using the interface builder. I pressed control, clicked on the button in Intro, and dragged the blue line to the Main view controller and selected "Show". I don't think I have any code in Main that would dismiss itself. I have an unwindToViewController function in it that get called when exiting Calculator. – Jesse Apr 07 '19 at 14:16
  • @E.Coms I think so - I set the classes in the Identity Inspector. Is that what you meant? – Jesse Apr 07 '19 at 14:19

0 Answers0