Add geometry change invalidation support#881
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #881 +/- ##
==========================================
- Coverage 26.95% 26.94% -0.01%
==========================================
Files 678 678
Lines 47139 47144 +5
==========================================
- Hits 12705 12704 -1
- Misses 34434 34440 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 Augment PR SummarySummary: Adds UIKit geometry-change hooks so hosting views can invalidate root transform state when host geometry changes. Changes:
Technical Notes: Geometry callbacks now trigger 🤖 Was this summary useful? React with 👍 or 👎 |
| uiView._unregisterForGeometryChanges() | ||
| registeredForGeometryChanges = false | ||
| } | ||
| if !wasRegisteredForGeometryChanges, registeredForGeometryChanges { |
There was a problem hiding this comment.
In Sources/OpenSwiftUI/Integration/Hosting/UIKit/View/UIHostingViewBase.swift:253, if !wasRegisteredForGeometryChanges, registeredForGeometryChanges looks effectively unreachable because this method only ever sets registeredForGeometryChanges to false. Consider double-checking that this is actually protecting against the “incidental registration” case you’re trying to guard.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| forAncestor ancestor: UIView? | ||
| ) { | ||
| base._geometryChanged(geometry, forAncestor: ancestor) | ||
| } |
There was a problem hiding this comment.
In Sources/OpenSwiftUI/Integration/Hosting/UIKit/View/UIHostingView.swift:251, overriding UIKit’s _geometryChanged(_:forAncestor:) without calling super may suppress UIKit’s internal geometry propagation. Consider confirming that skipping super._geometryChanged is safe across the UIKit versions you’re targeting.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Agent Summary
This adds UIKit geometry-change registration hooks to hosting views so transform invalidation can respond when host geometry changes.
The update forwards
_geometryChangedthrough_UIHostingView, lazily registers geometry observation when the root transform is requested, and unregisters when transform invalidation no longer needs observation. It also implementsViewGraph.invalidateTransform()so root transform state is invalidated and graph delegates are notified.Validation:
git diff --checkswift build(passes with existing project warnings)