SheetPresentationManager

public final class SheetPresentationManager : NSObject
extension SheetPresentationManager: UIViewControllerTransitioningDelegate
extension SheetPresentationManager: UIAdaptivePresentationControllerDelegate

An object that creates instances of SheetPresentationController when set as a view controller’s transitioningDelegate.

  • Creates a SheetPresentationManager with specific presentation options and tap handler.

    Declaration

    Swift

    public init(
        options: SheetPresentationOptions = .default,
        dimmingViewTapHandler: DimmingViewTapHandler = .default
    )

    Parameters

    options

    The options to use for presenting view controllers.

    dimmingViewTapHandler

    A handler to be called when tapping the dimming view. The dimmingViewAlpha of the given options must not be nil, or the dimming view will not be created.

  • Defines the animator object to use when presenting the view controller.

    Declaration

    Swift

    public func animationController(
        forPresented presented: UIViewController,
        presenting: UIViewController,
        source: UIViewController
    ) -> UIViewControllerAnimatedTransitioning?

    Parameters

    presented

    The view controller that is about to be presented onscreen.

    presenting

    The view controller that is presenting the view controller in the presented parameter. The object in this parameter could be the root view controller of the window, a parent view controller that is marked as defining the current context, or the last view controller that was presented. This view controller may or may not be the same as the one in the source parameter.

    source

    The view controller whose present(_:animated:completion:) method was called.

    Return Value

    The animator object to use when presenting the view controller or nil to use the system animator.

  • Defines the animator object to use when dismissing the view controller.

    Declaration

    Swift

    public func animationController(
        forDismissed dismissed: UIViewController
    ) -> UIViewControllerAnimatedTransitioning?

    Parameters

    dismissed

    The view controller that is about to be dismissed.

    Return Value

    The animator object to use when dismissing the view controller or nil to use the system animator.

  • Defines the custom presentation controller to use for managing the view hierarchy when presenting a view controller.

    Declaration

    Swift

    public func presentationController(
        forPresented presented: UIViewController,
        presenting: UIViewController?,
        source: UIViewController
    ) -> UIPresentationController?

    Parameters

    presented

    The view controller being presented.

    presenting

    The view controller that is presenting the view controller in the presented parameter. The object in this parameter could be the root view controller of the window, a parent view controller that is marked as defining the current context, or the last view controller that was presented. This view controller may or may not be the same as the one in the source parameter. This parameter may also be nil to indicate that the presenting view controller will be determined later.

    source

    The view controller whose present(_:animated:completion:) method was called to initiate the presentation process.

    Return Value

    The custom presentation controller for managing the modal presentation.

  • Defines the modal presentation style for the controller given a set of traits.

    Declaration

    Swift

    public func adaptivePresentationStyle(
        for controller: UIPresentationController,
        traitCollection: UITraitCollection
    ) -> UIModalPresentationStyle

    Parameters

    controller

    The presentation controller that is managing the size change.

    traitCollection

    The traits representing the target environment.

    Return Value

    The new presentation style, which must be UIModalPresentationStyle.fullScreen, UIModalPresentationStyle.overFullScreen, or UIModalPresentationStyle.none.

  • Defines the modal presentation style for the controller.

    Declaration

    Swift

    public func adaptivePresentationStyle(
        for controller: UIPresentationController
    ) -> UIModalPresentationStyle

    Parameters

    controller

    The presentation controller that is managing the size change.

    Return Value

    The new presentation style, which must be UIModalPresentationStyle.fullScreen, UIModalPresentationStyle.overFullScreen, or UIModalPresentationStyle.none.