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