You can call :
self.view.window!.rootViewController?.dismiss(animated: false, completion: nil)
Should dismiss all view controllers above the root view controller.
More Related Contents:
- Displaying images on another view controller when button is clicked
- Instantiate and Present a viewController in Swift
- Passing data between view controllers
- Programmatically set the initial view controller using Storyboards
- Fatal error: use of unimplemented initializer ‘init(coder:)’ for class
- Detecting sheet was dismissed on iOS 13
- How to set Status Bar Style in Swift 3
- Passing data back from view controllers Xcode
- How to pass Textfield value to view controller through button click in Swift UI
- Opening view controller from app delegate using swift
- How to reload data in a TableView from a different ViewController in Swift
- Present modal view controller in half size parent controller
- How to check if a view controller is presented modally or pushed on a navigation stack?
- Programmatically navigate to another view controller/scene
- Passing Image to another View Controller (Swift)
- Force landscape mode in one ViewController using Swift
- Access Container View Controller from Parent iOS
- How to get UIScrollView vertical direction in Swift?
- How to maintain presenting view controller’s orientation when dismissing modal view controller?
- Changing VC issue in Swift. How to pass data between views in tab bar controller?
- Custom init for UIViewController in Swift with interface setup in storyboard
- How to push and present to UIViewController programmatically without segue in iOS Swift 3
- Swift – Saving highscore using NSUserDefaults
- Expected declaration error for making high score [duplicate]
- Why can’t I call the default super.init() on UIViewController in Swift?
- In SwiftUI, how to use UIHostingController inside an UIView or as an UIView?
- Can’t Load UIViewController XIB file in Storyboard in Swift
- Rotation only in one ViewController
- Swift: Navigate to new ViewController using button
- Can’t cast value of type UIViewController to PatternDetailViewController