Should be possible to show same action sheet for links as UITextView

Originator:douglashill
Number:rdar://41134915 Date Originated:14-Jun-2018 03:36 pm
Status:Open Resolved:
Product:iOS + SDK Product Version:12.0
Classification:Enhancement Reproducible:Always
 
Summary:
It would be nice to get the same action sheets using for long pressing links in UITextView in our custom UI.

When long pressing a link in a UITextView, an action sheet is shown. The actions available in the action sheet depend on the type of link. The system handles many types of links, including web URLs (https:), phone numbers (tel:) messages (sms:) and email (mailto:). Each type has its own set of actions. UIKit is smart about which actions are available, handling things like email availability and calling a number via an iPhone when using an iPad.

Many (maybe all) of these actions are also available for links in WKWebView or SFSafariViewController.

We make PSPDFKit: a framework which renders PDF documents, which can contain any type of link. It would be nice if we could get all the of same features users expect when long pressing on links.

Steps to Reproduce:
Try to match UITextView’s UI when long pressing on links.

Expected Results:
I’m imagining UIKit providing some kind of factory method that supplies a preconfigured UIAlertController given a URL and a source view & rect or bar button item. With the source info it could for example present a UIActivityViewController (for Share…) without further involvements from the calling code.

Actual Results:
No convenient API from UIKit for this.

We can implement some of these actions manually ourselves, but this is tedious work and we risk missing some cases handled by UIKit. In practice, we’re going to mimic UIKit for the common case (web URLs) and probably say that’s enough.

Version:
12.0

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!