Sharing in iOS 8: Explained

Share extensions in iOS 8: Explained

Share extensions, part the new Extensibility features in iOS 8,are some of the most important additions to the platform since the launch of the App Store. That's right, sharing isn't just for Apple's own services and partners any more. Now, any app can hook into the system-wide Share Sheets and present a way to upload comments, photos, videos, audio, links, and more from within any other app. So, how does it work?

Sharing from the start

Sharing has always been part of iOS. Even on the very first iPhone you could share a photo via Mail. As time went on, more and more sharing options became available for more and more types of data. You could share videos and location, contact cards and website addresses, app and media links, voice memos, and more. And you could do it not only through Apple's own services like Messages but through the services they partnered with and integrated, like Twitter and Facebook, YouTube and Flickr.

Originally, Apple presented sharing options in a simple list. In addition to being rather drab, it didn't scale. With iOS 6, Apple added Share Sheets, a grid of icons that was both more dense and more visually parseable. Share Sheets included both the full-color icons of apps that could be used to share content, like Message or Twitter, and the grayscale icons of actions that could be performed on that content, like Copy or Print.

However, the grid still didn't scale enough and, aside from the color treatments, didn't visually separate sharing options from action options. So, with iOS 7, Apple not only redesigned Share Sheets in keeping with the overall new look and feel, they changed them from a grid to a set of rows. The top row was given over to the colorful, app-based sharing options and the bottom row to the black and white action icons. And both sets could scroll horizontally.

There was now room for more sharing options, but still only those made or integrated by Apple. At least until iOS 8...

How custom sharing works

With iOS 8 and Extensibility, gone are the days when Apple had to make a deal with social networks and laboriously integrate them one and a time into iOS. Now, any app you download from the App Store can hook into the Share Sheets and give you the option to share or upload your content with other members and to the service.

For example, Apple and Pinterest no longer have to come to any special deals or work on any unique implementations. Pinterest can simply add a share extension to their app. That way, when you download it, the Pinterest icon and option will become available in the Share Sheet just like the built-in options.

So, let's say you're in Safari and you see a great new iPhone case on iMore. You can simply tap the Share button, scroll across to Pinterest, and tap the icon to pin it. The sharing extension gets full access to Safari, so you can swipe through all the available images of that iPhone case and pick just exactly the one you want to pin. The extension also gets full, secure access to Pinterest via the Pinterest app, so you can choose just exactly which of your boards you want that iPhone case pinned to.

Because of custom sharing extensions, you also get the ability to customize your sharing options. Scroll all the way to the right on a Share Sheet and you'll see a special "More" icon. Tap it and you're taken to the Activities panel where you can toggle on or off all the sharing options (with the exception of Messages and Mail), and move all of them around into any order you like.

That means, if Pinterest is something you use a lot, you can move it to one of the first few slots. If Facebook is something you use never, you can switch it off and not worry about it taking up space and slowing you down.

The same would hold true for other networks like Google+, options like Mailbox, or online photo, video, or audio services like 500px or Vine. Anything that you can share socially or directly, or upload to an online collection could be made available to you in a share extension.

That makes for much easier, better workflows. Prior to iOS 8, you'd have to copy a URL, go to the social or IM app you wanted to share it from, paste it in, and then go from there. Prior to iOS 8, you'd have to go to the photo or video app you wanted to upload your content to, pull up the camera roll, search for and pick the photos or video you wanted to upload, and then go from there.

With iOS 8 and share extensions, you basically have a plugin that lets you share comments, photos, videos, audio, links, and more right from Safari or Photos or any appropriate apps that hooks into the Share Sheet system. You can share from wherever you are, whenever you have the content in front of you.

Like with widgets and interactive notifications, instead of going somewhere else and hunting around for what you want to do, iOS 8 brings it to you. It's more efficient, it's more convenient, and it's just plain better.

Developing share extensions

Share extensions are a way for developers to take the sharing and uploading features of their apps, package them, and put them into the system-wide Share Sheets so they can be invoked from inside any other appropriate app.

Like other Extensibility features, share extensions are view controllers. Two kinds of share extension view controllers are available to developers. The first is the standard, system-default share sheet look and feel. The second is a custom view controller.

System defaults are both quick to implement and offer a lot of functionality, like image preview, text entry, audience picker, etc. "for free". They also help maintain continuity of experience. Custom sheets are more work but can leverage code from the existing app and better show off a service's branding. That can be useful in continuously, visually reminding someone which service they're sharing to throughout the process.

In addition to view controllers, a display name tells people which app extension they're using. If apps include multiple sharing options, the a display will differentiate those as well.

Activation rules tells the system when to offer a particular app's extension. For example, when photos are selected, the activation rules for a photo app would tell iOS that it should be included in the options. If a web link or block of text is selected, however, the activation rules for a photo app would result in it not being included — the content simply isn't relevant to it.

Social networks, instant messengers, photo sharing services, video sharing services, microblogs, etc. can and will all have different, if sometimes overlapping activation rules. Developers can indicate their activation rules by using a predicate with as simple or as detailed a query string as is needed. Developers can also use condensed rules for even simpler criteria.

Both web URL and web pages are supported. The first is all about sharing a link. The second is all about pulling the data from the web page itself. Developers can, via JavaScript, determine which parts of a webpage their extension wants.

For any share extension that uploads content like photos or video, the process has to be run by the system in the background. Since extensions only "live" while they're being displayed, that allows the upload activity to persist for as long as it has to, even after someone has finished using the sharing interface and gone on to do something else.

Performance is just as important in share extensions as they are in other Extensibility feature. Apple encourages developers to keep things lean so interface can be shown quickly. Also, if large files like photos or videos are being accessed, to defer the actual transfer until after the sharing action is completed, so the interface can stay responsive.

There are a number of resources available to aid in all this:

Secure sharing

Share extensions are designed to provide extra functionality and convenience while still maintain the security- and privacy-first approach of iOS. This is why Extensibility is different than contracts and intents on other platforms, and is broken into several different, discreet bits of functionality like share extensions, action extensions, and photo editing.

iOS apps are "sandboxed" so they can only access their own data unless specific, explicit permission is given by the person using them. That's why apps need to request access to the camera roll, or why you have to tap the "Open in..." button. It makes it harder for malicious apps to do ever get onto the system and into your private data.

With iOS 8 and Extensibility, Apple keeps an app's extensions inside the app's sandbox, but allows iOS, and other apps by way of iOS, to reach out, request interface, information, and functionality. The container app can then project that interface, information, and functionality back to iOS or the host app right back.

For share extensions, the app you're sharing from is the host and the service you're sharing to is the container. For example, if you're in Safari or Photos, that's the host application. If you're sharing to Pinterest or Vine, that's the container. That not only provides security benefits but functional benefits as well. Neither the Pinterest nor Vine app needs to be running in advance for their share extension to work.

When a share extension is invoked it communicates securely, through iOS, back to the host app for things like posting permission or content. The developer needs to make sure all of that is available in a container that both the app and the extension have access to, but is otherwise secure in and of itself. iOS will then handle things like background video upload, leaving the extension to handle the user interaction.

Apple hasn't detailed the specifics of how all this works yet, but has said it uses similar security to the rest of iOS. Since iOS 7, Apple has done an incredible job with security and cryptography. I'm willing to bet Extensibility is enjoying something just as well thought out and just as secure.

Bottom line

Share extensions are just part of the the new Extensibility features offered in iOS 8 and a very specific part. They don't let you or developers do anything and everything. They're not area of effect, they're targeted. But what they do do is allow you to securely, privately share anything that interests you with anyone you want to share with, from anywhere and everywhere in iOS.

You no longer have to wait for or worry about Apple making — or not making — a specific partnership and integrating a specific service. Any service with an app on the app store can now get in on the sharing, and so can we.

Are there any social networks, instant messengers, mail apps, or photo or video sharing services you're eager to see come to Share Sheets?

More of iOS 8: Explained

Rene Ritchie

Editor-in-Chief of iMore, co-host of Iterate, Debug, Review, Vector, and MacBreak Weekly podcasts. Cook, grappler, photon wrangler. Follow him on Twitter and Google+.

More Posts

 

35
loading...
0
loading...
134
loading...
0
loading...

← Previously

How to quickly access your camera from the Lock screen on iPhone or iPad

Next up →

The Witcher Battle Arena to battle on all mobile platforms later this year

Reader comments

Share extensions in iOS 8: Explained

26 Comments
Sort by Rating

Correct me if I am wrong but it is 2014 and we still can not send contact to another platform with Bluetooth not to mention NFC. How is this innovative

Sent from the iMore App

Why on earth would I want to use bluetooth instead of email or text messages?

Yeah, I always love asking people to check their phone's settings to make sure they have a specific radio turned on rather than just hitting 'send' and knowing they'll get it no matter what.

Why on earth you want employ email to send something like picture, contact any or a file. If you are in area of bad coverage your state of the art iPhone is useless as a brick

Sent from the iMore App

Airdrop can do what you say. With the existing Airdrop feature, which debuted in iOS 7, I can share pictures, contacts, etc between iOS devices over an ad hoc peer to peer network. With the coming iOS 8 and OS X Yosemite, I will be able to share iOS to Mac.

So what's the problem?

greg_z is talking about cross-platform, direct connect sharing.

IMO, it's like asking why we can't put Ford parts in a Chevy. Competitors aren't usually too worried about cross compatibility.

BUT, simple, decade-old Bluetooth push could do this. But apple has crippled Bluetooth since day 1 with iOS. (They claim for security reasons) But that required pairing (from my experience, with old cell phones, Palms, etc).

Seems to me that Bluetooth LE proximity and on-screen confirmation could be used cross platform, even without the temporary Wi-Fi ad hoc, which AirDrop uses, this would be doable. Admittedly it would be slower if BT only, but that would be fine for contact cards, etc.

I think this is something that the 5% nerd-base wants. (I want QR reader built into the Apple Camera app) I don't carry business cards anymore bc I know I have options to send my info via AirDrop, text or email, and I don't have to worry about forgetting my phone vs the case or cards. Apple tends to focus on the majority, not the minority.

Apple doesn't currently deploy NFC. They've tried it, they don't like it. Unless and until that changes, we won't see any shipping devices with NFC.

The answer to why there's no BT device-to-device pairing is two-fold: Security and complexity.

iOS is a mainstream platform. It's not designed for geeks who pair BT, but normal folks who hit share options and are quite happy emailing or messaging a photo.

Sucks for geeks, way better for the other 90% of the populace.

I am not trolling just pointing out lack of functionality which could improve Apple product. Frankly if you don't tell what you want you won't get it. It is your choice to believe that Apple knows better and follow blindly.

Sent from the iMore App

Well you also can only add a certain amount of pictures to an email, so let's discuss that as well /s

Sent from the iMore App

You're speaking of innovation but bluetooth contact sending has been around since the feature phone era, so if they did implement it, that still would not be innovation. And not every phone has NFC.
I'm still hoping for Wi-Fi Direct...

This is what you're arguing over? Textbook definition of a first world problem?

Buy the phone you like. Leave others alone. End of story.

Ah ... you just outed yourself as an idiot/juvenile/whatever by using the "sheep" reference.

The thing I find funny is that the "sheep" thing is supposed to be a dig at Apple users, when in fact, the people using it are all basically "sheep" themselves, by chiming in with this buzzword that they don't even understand the meaning of simply because they heard a lot of other people using it and it's the "in" thing to do right now.

Irony. :-)

one a side note: when every keep app will have its extension it s going to be mess to browse horizontally all those extensions to find the one you need. What would be great is if apple system either lets you customize this (remove or reorder) or intelligently show first the one most likely relevant. Also in which order will they appear? alphabetical?

indeed, but it does not adress in which particular order a set of extension serving the same purpose (eg picture sharing) will appear. Alphabetical? order of install date? Can the user change that?

From the article:

"Because of custom sharing extensions, you also get the ability to customize your sharing options. Scroll all the way to the right on a Share Sheet and you'll see a special "More" icon. Tap it and you're taken to the Activities panel where you can toggle on or off all the sharing options (with the exception of Messages and Mail), and move all of them around into any order you like.

"That means, if Pinterest is something you use a lot, you can move it to one of the first few slots. If Facebook is something you use never, you can switch it off and not worry about it taking up space and slowing you down."

I like using Camera+ for photo edits. Currently, Tap Tap Tap only allows import from other apps, but not export to other apps. I hope that changes with iOS 8.

I hope Pushbullet comes to iOS. Even without notification mirroring, the IFTTT features and the ability to share literally anything to another device or another person is awesome in itself

Posted via iMore App

Pushbullet is already available for ios. It's just not as good as on Android. I expect that and their fortunes to change with ios 8.