Good evening!

I'm new on programming and I'm trying to make a swift application that goes like this:

A --segue--> B --segue--> C

I´m using modal segues between the view controllers.

Then I want to go back from the third view controller to the first one and I'm currently using the following code:

C ---dismissCandB---- > A

self.presentingViewController!.presentingViewController!.dismissViewControllerAnimated(false, completion: nil)

I´m not using NavigationController on this app so any code trying to solve this issue envolving Navigation Controller settings won´t help me.

The problem is: I wanted an animation involving only the third and the first view controllers (just like a modal segue from C to A). But I can't use the segue because in order the app to work properly I need to pass data from C to A through delegates (and not prepareforsegue).

When I set the boolean value to "true", the animation always involves the second view controller, and I don't want it to be shown.

Any ideas on how can I make this work? Thanks in advance.

1

There are 1 answers

3
Dharmesh Kheni On BEST ANSWER

I think you need this code:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("FirstViewController") as! UIViewController
self.presentViewController(vc, animated: true, completion: nil)