Share sheet needs an API for file type options, like Safari and Photos in iOS 13
Feedback ID: FB6187195
In iOS 13, the share sheet in Safari and Photos includes an “Options” button. This button can be tapped to reveal settings that affect what type of content is shared. This is an ideal solution to a problem I’ve been struggling with for years—a problem that has become more of an issue in iOS 13.
My app deals with deliveries (shipments, packages, tracking numbers). There’s no standard file type for a delivery. When someone shares a delivery, they may want to share any one or more of these things:
- A file that contains all of the delivery data, if they’re sharing with another user that has the app
- A link to the tracking page
- The name of the item and a tracking number
- An image of a map showing the shipping path
- A PDF of the map and tracking details
Currently I handle this situation by giving UIActivityViewController multiple placeholder activity items. I then use a custom UIActivityItemProvider to adjust what data is actually returned based on the activity type chosen. Twitter and Facebook get an image. Mail gets a nicely formatted email. Messages gets text and a link. AirDrop uses a Deliveries file format that only works if the receiver has Deliveries.
This works, but it’s complicated, unpredictable, and occasionally buggy. The biggest issue is finding the perfect balance of placeholder activity items to offer. If I offer too many types, then many sharing options don’t appear at all. (At least once I’ve also seen a bug where, if a file is sent via AirDrop, and then another activity is chosen, the same file is reused instead of requesting new items.)
This approach is even more complicated in iOS 13 beta 1 and 2. The share sheet now includes a preview of the shared content, giving the user an expectation for what will be sent. This makes it unacceptable to significantly change the data type based on the activity chosen.
My tentative plan to deal with this was to ask the user to choose every time they share: first pick the file type, then how to share it. I really don’t like this approach because it forces them to choose every time, and it separates two closely tied decisions. For example, they may know they want to share via Messages, but not know what file types can be shared there.
The approach used in Safari is what I’ve been wanting for years: a way to integrate this choice with the share sheet itself. This way it’s not always necessary to make a choice. If they do make a choice, they can see the sharing options available for the chosen format—then change it again if they need to, without leaving the share sheet.
It’s clear that the people working on the share sheet understand these issues very well and have created a solution that’s designed to work in multiple apps. Please consider making an API available so third-party apps can take advantage of this work.
Link to this entry: https://mikepiontek.com/go/8970