Apple announced some new Quick Look features for visionOS 2.0 at WWDC 2024. In this article we'll look at new ways to use QuickLook in Apple Vision Pro.
Quick Look for visionOS 2.0.
Quick Look is a feature of visionOS that allows users to preview large renderings of visionOS app objects in 3D with enhanced resolution. By using Quick Look, users can select 3D objects in visionOS and enlarge them for a 3D preview.
To provide a Quick Look preview in your visionOS app, all you need to do is provide a URL.
There are two methods for previewing 3D content in Quick Look on visionOS: in-app style or windowed (similar to how Quick Look works in macOS).
In-app style
With in-app style you can view 3D objects in a visionOS scene in-place, without having to open a separate interface. In-app style provides quick and easy previews of 3D objects simply by tapping on them.
Using in-app style allows users to manipulate and preview objects directly.
Windowed
In windowed Quick Look, 3D objects are displayed in a volume, allowing you to view all available 3D objects in a single overlay window.
Windowed Quick Look is handy for viewing numerous objects with ease and it's faster since you can cycle through all available objects in one space instead of having to select each one, and then preview it.
The volumes browser in Windowed Quick Look
PreviewApplication API
visionOS 2 provides a new PreviewApplication API utilizing SwiftUI and concurrency to allow developers to include Quick Look in their visionOS apps with just a few lines of code.
Using the PreviewApplication API, visionOS apps can provide a Quick Look preview for a single object, or a group of previews using a Collection View.
To use the PreviewApplication API you'll need to create a new View
subclass in a Swift file in Xcode, and also import
the QuickLook
framework at the top of your view subclass file.
In the body
of your View subclass, add a thumbnail view and an .onTapGesture
method.
Inside your .onTapGesture
method, first create a PreviewItem
, pass in the URL(s) of your 3D object(s) then call the PreviewApplication.open
method, passing in the preview item you created.
Create the preview item and URLs in a thumbnail view subclass.
Using this code, when the user taps on a file, it opens in a new window in the visionOS workspace. If the file contains video, the video begins playing automatically.
By passing an array of URLs in the .selectedURL
parameter instead of a single URL, you can allow the user to preview multiple items in a Collection View Quick Look window.
You can also specify whether or not to display a preview editing tab so the user can make edits to the item being previewed by setting the editingMode:
parameter to .enabled
. You can also change the current title of the item being previewed.
There are other new Quick Look API changes in visionOS 2 including Quick Look preview session events and others.
Configurations
Quick Look in visionOS 2 also provides Configurations. With Configurations, you can specify options or variants of 3D objects for the user to choose from. These can include size, color, transparency, etc.
You can also provide texture options for 3D objects in Quick Look, but keep in mind all Quick Look previews should be able to load quickly so you shouldn't include any options that take too much time to render.
By using Configurations, you can allow users to customize 3D objects in the visionOS environment.
Use Configurations to support different 3D models or colors.
Apple has a session What's new in Quick Look for visionOS covering new features and changes in Quick Look for vision OS 2.0 from WWDC24.
Also be sure to check out the Quick Look documentation and Previewing a Model with AR Quick Look.
There's also a Quick Look 3D model overview gallery which shows how to provide visionOS users with high-resolution 3D previews of objects on Apple Vision Pro.