View model usage
Asked on 06/11/2025
1 search
In the session titled "Optimize SwiftUI performance with Instruments" from WWDC 2025, the concept of using view models to optimize SwiftUI performance is discussed. The session explains how creating an observable view model for each view can help in making data dependencies more granular. This approach ensures that when data changes, only the necessary view bodies are updated, rather than all views being marked as outdated. By having each view depend directly on its own view model, performance is improved as only the affected views are updated.
For more details, you can refer to the session Optimize SwiftUI performance with Instruments (00:28:55).

Optimize SwiftUI performance with Instruments
Discover the new SwiftUI instrument. We’ll cover how SwiftUI updates views, how changes in your app’s data affect those updates, and how the new instrument helps you visualize those causes and effects. To get the most out of this session, we recommend being familiar with writing apps in SwiftUI.

Code-along: Bring on-device AI to your app using the Foundation Models framework
Develop generative AI features for your SwiftUI apps using the Foundation Models framework. Get started by applying the basics of the framework to create an awesome feature. Watch step-by-step examples of how to complement the models with tools you build, stream results, and apply further optimizations for great performance.

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”.