SwiftUI Weekly - Issue #238
The hidden cost of unstable SwiftUI environment defaultsThe Splitting Large SwiftUI Views in the Apple's wayA separate View struct with narrow inputs gets its own boundary. SwiftUI can skip its body when only its inputs are unchanged. That’s the difference “skip for readability” and “split for performance”. The Anatomy of a Reusable SwiftUI ViewWhenever I build a custom reusable SwiftUI view as part of a larger application's design system, I follow the same principle: design its API to be as close as possible to Apple's view APIs. This keeps the "distance" between the behaviour of custom views and native view primitives small, and developers do not need to learn new ways of interacting with custom views. Equatable properties in @Observable classesOne of the main advantages of using @Observable models in SwiftUI is that the framework can track individual property accesses. When a view reads a property in its body, it only needs to reevaluate when that property changes, rather than whenever another part of the model is updated.
|