Closed jorgej-ramos closed 11 months ago
You can't just override the entire delegate. See https://github.com/siteline/swiftui-introspect/issues/363#issuecomment-1722529611 for details.
First of all, thank you for taking the time to respond.
Indeed, taking into account the UIScrollViewDelegate
that SwiftUI manages behind the scenes is mandatory so as not to break the cycles of SwiftUI's internal structure.
I had been mulling over the problem for so long that I hadn't thought about this. And it makes perfect sense. Is working.
Kudos to you for the help!
Description
It seems that the implementation of
.introspect
is somehow blocking the correct behavior of.scrollPosition
in a ScrollView.We can see it using the following example:
If we implement
.introspect
, we will stop receiving updates onposition
.If we don't implement it, we won't be able to use
UIScrollViewDelegate
but instead.scrollPosition
will work again.I have tried placing the statement
.scrollPosition(id: $position)
before and/or after the implementation of.instrospect
, but the result is the same in all cases.Also, this implementation has been tested on
LazyHStack
before and afterscrollTargetLayout()
with no success.Checklist
Expected behavior
The expected behavior is that
.scrollPosition
and.introspect
can coexist, in such a way that updates are received from both, and both the current position and whether the ScrollView is scrolling or not are displayed.Actual behavior
Currently, it appears that
.introspect
is overriding the ability to receive updates from.scrollPosition
Steps to reproduce
.introspect
modifier to see the differences.Version information
1.1.0
Destination operating system
iOS 17
Xcode version information
Version 15.0.1 (15A507)
Swift Compiler version information