#Preview

Generated on 10/25/2024

1 search

Preview in Xcode 16

In the session titled "What’s new in Xcode 16," several enhancements to the preview system were introduced. The previewable macro allows developers to attach it to property wrappers like state, enabling direct use within a preview block without needing to write wrapper views. This simplifies the process of creating live UI previews with minimal code. Additionally, the preview modifier API helps share environment or data across previews, reducing duplicate code and enabling data caching for improved performance. These updates are part of a broader effort to enhance the speed and efficiency of previews, powered by advances in the compiler and build system.

Quick Look for visionOS

The session "What’s new in Quick Look for visionOS" introduced the preview application API, which gives apps more control over the Quick Look experience. This includes managing the lifecycle of previews and customizing the display of 3D content. Notably, the API allows for surface snapping, enabling 3D models to be positioned on horizontal surfaces like tables or floors. This feature enhances the spatial media preview capabilities of apps, making it easier to create immersive experiences.

SwiftData Previews

In "What’s new in SwiftData," the session discussed setting up shared contexts for previews using model containers. This approach allows for in-memory data storage, making it easier to work with sample data in SwiftUI views. The previewable macro can also be used to create effective previews for views that rely on models being passed to them, enhancing the development process by providing realistic data scenarios.

Relevant Sessions

What’s new in Quick Look for visionOS

What’s new in Quick Look for visionOS

Explore how Quick Look in visionOS can elevate file preview and editing experiences in your app. We’ll cover the integration of in-app and windowed Quick Look, as well as a brand-new API that customizes the windowed Quick Look experience in your app. We’ll also share the latest enhancements to viewing 3D models within Quick Look.

What’s new in USD and MaterialX

What’s new in USD and MaterialX

Explore updates to Universal Scene Description and MaterialX support on Apple platforms. Discover how these technologies provide a foundation for 3D content creation and delivery, and learn how they can help streamline your workflows for creating great spatial experiences. Learn about USD and MaterialX support in RealityKit and Storm, advancements in our system-provided tooling, and more.

What’s new in Xcode 16

What’s new in Xcode 16

Discover the latest productivity and performance improvements in Xcode 16. Learn about enhancements to code completion, diagnostics, and Xcode Previews. Find out more about updates in builds and explore improvements in debugging and Instruments.

What’s new in SwiftData

What’s new in SwiftData

SwiftData makes it easy to add persistence to your app with its expressive, declarative API. Learn about refinements to SwiftData, including compound uniqueness constraints, faster queries with #Index, queries in Xcode previews, and rich predicate expressions. Join us to explore how you can use all of these features to express richer models and improve performance in your app. To discover how to build a custom data store or use the history API in SwiftData, watch “Create a custom data store with SwiftData” and “Track model changes with SwiftData history”.