The view controller that presented this view controller.
SDKs
- iOS 5.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
var presentingViewController: UIView Controller? { get }
Discussion
When you present a view controller modally (either explicitly or implicitly) using the present(_:
method, the view controller that was presented has this property set to the view controller that presented it. If the view controller was not presented modally, but one of its ancestors was, this property contains the view controller that presented the ancestor. If neither the current view controller or any of its ancestors were presented modally, the value in this property is nil
.