0
votes

In the application I can go from screen A to B to C. Also I can go from screen A to E and also I can go from screen C to E.

I want to know the entry point from where Controller E is presented.

PS : application is storyboard less and can’t post code due to confidentiality.

App is in Swift 3. Looking for some suggestions.

2
What do you mean by the entry point? - Sweeper
I mean by entry point that if controller E is launched by controller A or C. So entry point for Controller E is A or C. - Shruti
@Shruti : You want top root view controller which is loaded from UIWindow? or you want last view controller which is presented current viewcontroller? - Ankit Chauhan
@AnkitChauhan I want the last view from where this current view controller is presented - Shruti

2 Answers

1
votes

why dont you just use the parent property of E viewController and check the source that presented it you can do something like

           if let parentController = self.parent as? A {
           //do smething
           }
           else if let parentController = self.parent as? C {
           //do smething
            }
0
votes

The most simple way is to pass some data in your segue

i.e.

if segue.identifier == "showDest"{
let destVc = segue.destination as! YourViewController
destVC.source = currentVC
}