Search code examples
iosswiftpopover

popoverPresentationController ios swift


while reading in the apple documentation i have came across this property in the UIViewController class

popoverPresentationController Property The nearest popover presentation controller that is managing the current view controller. (read-only)

Declaration SWIFT

var popoverPresentationController: UIPopoverPresentationController? { get }

Discussion If the view controller or one of its ancestors is managed by a popover presentation controller, this property contains that object. This property is nil if the view controller is not managed by a popover presentation controller.

If you created the view controller but have not yet presented it, accessing this property creates a popover presentation controller when the value in the modalPresentationStyle property is UIModalPresentationPopover. If the modal presentation style is a different value, this property is nil.

i didn't quit understand what this property will return and what is the use of it. if anybody can explain it better to me and i will be thankful.


Solution

  • If a view controller is presented as a popover, it has a popoverPresentationController whose methods and properties you might need to access. For example, the way you set a popover's passthroughViews is by setting the popover presentation controller's passthroughViews property.