Contents

modalPresentationStyle

The presentation style for modal view controllers.

Declaration

var modalPresentationStyle: UIModalPresentationStyle { get set }

Discussion

Presentation style defines how the system presents a modal view controller. The system uses this value only in regular-width size classes. In compact-width size classes, some styles take on the behavior of other styles. You can influence this behavior by implementing the adaptivePresentationStyle(for:traitCollection:) method.

Presentation style also impacts the content size of a modal view controller. For example, UIModalPresentationStyle.pageSheet uses an explicit size that the system provides. By contrast, UIModalPresentationStyle.formSheet uses the view controller’s preferredContentSize property, which you can set.

The default value is UIModalPresentationStyle.automatic. For a list of presentation styles and their compatibility with the various transition styles, see UIModalPresentationStyle.

See Also

Presenting a view controller