so I have a main view controller that the view controllers will present inFront of each other and I want when user click the button in the last view controller close all of the presented modally view controllers so I used this code But I didn't get the result
let destination = matchViewController()
let appDelegate:UIApplicationDelegate = UIApplication.shared.delegate!
let initialViewController = destination
let navigationController = UINavigationController(rootViewController: initialViewController)
appDelegate.window??.rootViewController = navigationController
appDelegate.window??.makeKeyAndVisible()
I want to use unwind segue to exit But there is another problem too the last view controller will present many times in many different situations so I just to dismiss all presented modally view controllers in. this situation I rather not using the navigationController But if I had to use it pleas tell me where exactly should I use that ?