danielsaidi / SwiftUIKit

SwiftUIKit is a Swift SDK that adds extra functionality to Swift & SwiftUI.
MIT License
1.42k stars 56 forks source link

ScrollViewGestureButton issues with iOS18 #30

Open jhull opened 3 months ago

jhull commented 3 months ago

Discovered this package recently - wonderful, thank you!

ScrollViewGestureButton was working great for me in iOS17.5, but after upgrading to 18 both on device and in Xcode, I lose all scroll abilities and the view locks up.

This happens in both the simulator and on device.

Relatively new to SwiftUI so not sure how to fix...

danielsaidi commented 3 months ago

Hi @jhull

Thank you for letting me know!

I will extract the buttons to a separate package and have a look at it closer to the iOS 18 release.

danielsaidi commented 2 months ago

Hi again @jhull

I have confirmed the bug and will try to fix what's happening. Did you find any workaround?

danielsaidi commented 2 months ago

Hi again @jhull

I am struggling to fix this issue, which is caused by iOS 18 changing how drag gestures affect scrollviews.

I found more information here:

https://stackoverflow.com/questions/78912852/adding-a-high-priority-drag-gesture-to-a-scrollable-view-in-ios-18-causes-the-sc

danielsaidi commented 2 months ago

@jhull I think I have a workaround for this problem. Basically, iOS 18 doesn't need the ScrollViewGestureButton approach, but can instead use the GestureButton everywhere, if we only change its gesture to be a simultaneous gesture.

For iOS 17 and earlier, I will add a isInScrollView parameter or something like that, which will resolve the old scroll view button view under the hood. When we later drop support for iOS 17 in a few years, we can just remove that scroll view.

I will release this as a separate package.