-
Notifications
You must be signed in to change notification settings - Fork 79
Add geometry change invalidation support #881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,8 +230,30 @@ package class UIHostingViewBase { | |
| } | ||
| } | ||
|
|
||
| @inline(__always) | ||
| func updateTransform() { | ||
| guard let uiView else { | ||
| return | ||
| } | ||
| if !viewGraph.invalidateTransform(), registeredForGeometryChanges { | ||
| uiView._unregisterForGeometryChanges() | ||
| registeredForGeometryChanges = false | ||
| } | ||
| } | ||
|
|
||
| package func updateTransformWithoutGeometryObservation() { | ||
| _openSwiftUIUnimplementedFailure() | ||
| guard let uiView else { | ||
| return | ||
| } | ||
| let wasRegisteredForGeometryChanges = registeredForGeometryChanges | ||
| if !viewGraph.invalidateTransform(), registeredForGeometryChanges { | ||
| uiView._unregisterForGeometryChanges() | ||
| registeredForGeometryChanges = false | ||
| } | ||
| if !wasRegisteredForGeometryChanges, registeredForGeometryChanges { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Severity: low 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| uiView._unregisterForGeometryChanges() | ||
| registeredForGeometryChanges = false | ||
| } | ||
| } | ||
|
|
||
| @inline(__always) | ||
|
|
@@ -510,7 +532,14 @@ package class UIHostingViewBase { | |
| } | ||
|
|
||
| package func _geometryChanged(_: UnsafeRawPointer, forAncestor: UIView?) { | ||
| _openSwiftUIUnimplementedFailure() | ||
| guard let host else { | ||
| return | ||
| } | ||
| if registeredForGeometryChanges { | ||
| host.invalidateProperties(.transform, mayDeferUpdate: false) | ||
| } else if !options.contains(.registeredForGeometryChanges) { | ||
| Log.internalError("Received _geometryChanged with no registration for \(self).") | ||
| } | ||
| } | ||
|
|
||
| package func layoutSubviews() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
Sources/OpenSwiftUI/Integration/Hosting/UIKit/View/UIHostingView.swift:251, overriding UIKit’s_geometryChanged(_:forAncestor:)without callingsupermay suppress UIKit’s internal geometry propagation. Consider confirming that skippingsuper._geometryChangedis safe across the UIKit versions you’re targeting.Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.