A specialized view controller for previewing an item.
- iOS 4.0+
- Mac Catalyst 13.0+
QLPreview can display previews for many common file types, including the following:
Microsoft Office documents
Rich Text Format, or RTF, documents
Text files with a uniform type identifier (UTI) that conforms to the
publictype. To learn more about UTIs, see the Uniform Type Identifiers Reference.
Comma-separated value, or CSV, files
3D models in the usdz format with both standalone and AR views for viewing the model
On iOS devices, you can present a
QLPreview modally by calling
present(_: from a presenting
UIView, or you can push it into view using a
UINavigation. The preview includes a title taken from the last path component of the item URL. You can override it by implementing a
preview accessor for the preview item.
To use a preview controller, you must provide a data source object. The data source provides preview items to the controller and tells it how many items to include in a preview navigation list. If there’s more than one item in the list, a modally presented controller displays navigation arrows to let the user switch among the items. If you pushed a preview controller into view using a navigation controller, you can provide buttons in the navigation bar for moving through the navigation list.