Skip to content

Commit 6a343c8

Browse files
authored
Perform view updates during scroll tracking (#679)
When we enable floatingPanelScrollTracking on our view inside of the floating panel, some view updates are performed (i.e., SwiftUI views are being instantiated) but no rendering (i.e., body evaluations) occurs. Example code: ```swift content .floatingPanel( coordinator: ContentPanelCoordinator.self, onEvent: onEvent ) { proxy in panelContent .floatingPanelScrollTracking(proxy: proxy) // scroll tracking breaks view updates } ``` We tracked this down to the scroll tracking, and it seems that the performing of view updates inside of the ScrollViewRepresentable was missing. This seems similar to #675.
1 parent cd135b3 commit 6a343c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SwiftUI/View+floatingPanelScrollTracking.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ private struct ScrollViewRepresentable<Content>: UIViewControllerRepresentable w
6868
return vc
6969
}
7070

71-
func updateUIViewController(_ uiViewController: ScrollViewHostingController<Content>, context: Context) {
71+
func updateUIViewController(
72+
_ uiViewController: ScrollViewHostingController<Content>,
73+
context: Context
74+
) {
75+
uiViewController.rootView = content()
7276
}
7377

7478
class ScrollViewHostingController<V>: UIHostingController<V> where V: View {

0 commit comments

Comments
 (0)