menu
techminis

A naukri.com initiative

google-web-stories
Home

>

PC & Laptops News

>

Automatic ...
source image

Mjtsai

4w

read

181

img
dot

Automatic Observation Tracking in UIKit and AppKit

  • Apple has introduced automatic observation tracking in UIKit and AppKit in iOS 18/macOS 15 to enable views to update when properties change.
  • The feature, akin to SwiftUI's automatic view updates, can be enabled with a simple plist entry.
  • Key UIKit and AppKit methods supporting this feature include viewWillLayoutSubviews(), layoutSubviews(), viewWillLayout(), and layout().
  • Developers can now use @EnvironmentObject-like behavior in UIKit to easily access objects throughout the app.
  • The keys for enabling this tracking are UIObservationTrackingEnabled and NSObservationTrackingEnabled.
  • It automatically observes changes to object properties and triggers view updates accordingly.
  • However, it seems limited to fixed sets of objects in views and might require additional handling for dynamic content.
  • Comparisons to KVO suggest that changes impacting displayed objects' eligibility may need manual observation implementation.

Read Full Article

like

10 Likes

For uninterrupted reading, download the app