Are viewmodels recommended
Asked on 06/11/2025
1 search
Yes, viewmodels are recommended in SwiftUI to optimize performance by making data dependencies more granular. In the session Optimize SwiftUI performance with Instruments, it is explained that by creating an observable viewmodel for each view, you can track specific data changes, such as a favorite status, more efficiently. This approach reduces unnecessary view body updates, as each view only depends on its own viewmodel rather than a larger data structure. This helps in keeping the app running smoothly by ensuring that only the necessary view bodies are updated when data changes.

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: Elevate an app with Swift concurrency
Learn how to optimize your app’s user experience with Swift concurrency as we update an existing sample app. We’ll start with a main-actor app, then gradually introduce asynchronous code as we need to. We’ll use tasks to optimize code running on the main actor, and discover how to parallelize code by offloading work to the background. We’ll explore what data-race safety provides, and work through interpreting and fixing data-race safety errors. Finally, we’ll show how you can make the most out of structured concurrency in the context of an app.

Bring your SceneKit project to RealityKit
Understand SceneKit deprecation and explore how to transition your 3D projects to RealityKit, Apple’s recommended high-level 3D engine. We’ll clarify what SceneKit deprecation means for your projects, compare key concepts between the two engines, and show you how to port a sample SceneKit game to RealityKit. We’ll also explore the potential of RealityKit across all supported platforms to help you create amazing 3D experiences with your apps and games.