UITextView doesn't handle "shouldInteractWithURL" correctly on iOS 13.1

Hello
When we have links in our scrollable UITextView contents, and we want to handle them ourselves (in our case - to open articles inside our app), there's an issue when we scroll. It seems that when we start scrolling when placing finger on a link, link is opened immedietely, without any chance to scroll the contents, which maybe very annoying for the user.


Steps to reproduce:

- Have an app, with scrollable UITextView, and a delegate method "textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction)" implemented that it performs some action (for example opens a given URL in SafariViewController) and returns "false"

- Observe that if we start scroll, holding finger over the link, an URL action (for example: opening a link in SafariViewController) is performed immedietaly


Expected behavior:

- Scroll should be allowed Please note, that with default behavior (opening link in Safari) - this issue is not happening. Simple project is attached that reproduces this issue on iOS 13.1 (tested on 13.1.2) Issue doesn't happen on iOS 12.x

It seems like a bug on iOS 13.1, and unfortunately, affects also apps built with iOS 12 SDK.


Here are some informations about others that noticed that issue: https://stackoverflow.com/questions/58189447/ios-13-1-uitextview-delegate-method-shouldinteract-called-when-scrolling-on-atta , unfortunataly it seem that workaround is not working for us in presented form.
This issue was reported as FB7343964 on Feedback Assistant, not sure how it would translate to a Radar, if possible?


Does anyone have some, relatively clean workaround?

Replies

It depnds on your app really. We're working around it by just removing the UITextViewDelegate in some places, and allowing the UITextView's default behavior to take over - just opening links in Safari. When the delegate method implementation is removed, everything scrolls fine. But this only works for us in some places and not all.


Two interesting workarounds I'm aware of: https://twitter.com/dezinezync/status/1177823514276978688 and https://twitter.com/drewmccormack/status/1178026774015483904


FB7330543 is the one I filed a week ago, and it's marked as None/Open. Here's to hoping for a fix soon, the amount of apps I've seen affected by this is surprisignly high.