What's the difference between the updateProperties method introduced and the viewWillLayoutSubviews introduced for Observation tracking in UIKit?
Asked on 2025-06-11
•@wwdc252 searches
The updateProperties
method and viewWillLayoutSubviews
serve different purposes in UIKit's observation tracking and layout process.
updateProperties
Method
- Purpose: Introduced to support automatic trait and observation tracking in UIKit. It is a general-purpose update method that allows you to populate content, apply styling, or configure behaviors.
- Timing: Runs just before
layoutSubviews
but is independent of it. This means you can invalidate properties without forcing a layout, allowing for finer-grained updates. - Functionality: Automatically tracks any observable you read, and you can manually trigger it by calling
setNeedsUpdateProperties
. - Use Case: Ideal for updating properties that depend on observable objects, such as updating a badge view when the underlying model changes, without triggering unnecessary layout passes.
viewWillLayoutSubviews
- Purpose: Part of the traditional layout process in UIKit, used to make adjustments before the layout of subviews.
- Timing: Called during the layout pass, after traits have been updated and before the actual layout logic is executed.
- Functionality: Typically used to adjust the layout of subviews based on the current state of the view hierarchy.
- Use Case: Suitable for making layout adjustments that are necessary due to changes in the view hierarchy or size.
In summary, updateProperties
is designed to handle updates related to observable properties and is independent of the layout process, whereas viewWillLayoutSubviews
is part of the layout process itself. This separation allows for more efficient updates and avoids unnecessary layout passes. For more details, you can refer to the session What’s new in UIKit (12:30).

What’s new in UIKit
Modernize your app with the latest APIs in UIKit, including enhanced menu bar support, automatic observation tracking, a new UI update method, and improvements to animations. We’ll also cover how you can include SwiftUI scenes in your UIKit app and explore SF Symbols, HDR color pickers, and more.

What’s new in Swift
Join us for an update on Swift. We’ll talk about workflow improvements that make you more productive, and new and modernized library APIs for fundamental programming tasks. We’ll show examples of Swift adoption throughout more layers of the software stack. Finally, we’ll explore new language features for both improving approachability of concurrency, and achieving peak performance when you need it.

Better together: SwiftUI and RealityKit
Discover how to seamlessly blend SwiftUI and RealityKit in visionOS 26. We’ll explore enhancements to Model3D, including animation and ConfigurationCatalog support, and demonstrate smooth transitions to RealityView. You’ll learn how to leverage SwiftUI animations to drive RealityKit component changes, implement interactive manipulation, use new SwiftUI components for richer interactions, and observe RealityKit changes from your SwiftUI code. We’ll also cover how to use unified coordinate conversion for cross-framework coordinate transformations.