iOS 8's Application Extensions
Last year, with iOS 7, Apple overhauled the appearance of its mobile operating system for the first time since its inception. It was a striking, drastic departure from the skeuomorphic design language used in previous versions and easily recognizable at a glance. The changes in iOS 8, launching alongside the iPhone 6 and 6 Plus, while not immediately noticeable, are just as significant. Sitting below the now familiar facade, which receives only minor tweaks, is a wealth of opportunity for developers. Rather than building the walls surrounding the OS core higher, Apple has been busy building doors and allowing third-party apps supervised access into the forbidden zone.
Application Extensions: Powering iOS 8’s Biggest New Features
In iOS, all apps run inside a sandbox, which, among other things, means third-party apps can’t communicate with other apps or access their data. While good for security, this barrier hinders productivity. For example, moving files between two apps requires a third app or service to act as an intermediary, like emailing yourself a file and using the "Open In..." option or uploading the file to Dropbox. Apple’s new doorways, or application extensions, circumvent this cumbersome process by allowing apps to provide additional functionality within other apps and to access files outside of its own sandbox directly.
Many of iOS 8’s new features are enabled by these application extensions. The action extension allows an app to manipulate data within another app, somewhat analogous to a Web browser plug-in. During the WWDC keynote presentation, Apple demonstrated this extension by using Bing Translate inside Safari to translate the text of a webpage.
The photo editing extension is a more specialized version of the action extension, allowing a third-party app to edit a photo or video inside the Photos app. Another specialized extension, which enables one of iOS 8’s most anticipated features, is custom keyboard. This provides the ability to replace Apple’s default keyboard with a third-party keyboard, system-wide. Now iOS users, envious of Android’s keyboard selection, get to Swype away impediments to text entry with a keyboard of their choice.
Widgets, another staple Android feature, finally make their debut in iOS thanks to the today extension. Unlike Android, which places its widgets on the home screen, iOS 8 widgets live within the Today view in the Notification Center shade. Widgets can be added, removed and reordered by tapping the Edit button at the bottom of the screen in Today view. Any installed apps that offer widget functionality automatically appear in this list and must be manually enabled. Apple’s decision to place widgets in the Notification Center keeps the home screen uncluttered, but does require an extra step to view them, an inconvenience slightly offset by having access to them from the lock screen.
After opening the Notification Center, there may be a slight delay for a widget to update its information. This is due to the strict memory policy Apple places on widgets to keep them from draining the battery or impacting performance. Even though extensions, including widgets, are packaged inside a containing app, they are separate binaries that run independently of the containing app. Thus, iOS can start and stop widgets and manage their memory space separately from the app providing the widget.
The share extension makes it easier to share pictures, links and files with online services from within apps. Previously, iOS allowed posting to Facebook and Twitter from any app, but uploading a file to a service like Dropbox required each developer to include Dropbox API support within their app. This method placed a burden on programmers to try and include support for the myriad services on the Web—clearly impractical—and led to frustrated users whose preferred service wasn’t supported by all of their apps. With share extensions, however, a service provider like Google can create an extension for the Google Drive app that instantly gives all apps the ability to upload to Google Drive through the Share menu.
The Storage Provider extension, which simplifies sharing documents between apps, has the potential to be the most useful. A first for iOS, users can now edit the same document with multiple apps, without multiple step file transfers and creating copies of the document in each app. Similar to the share extension, an app with a Storage Provider extension appears in the Document Picker interface when creating or opening a file. For example, installing Microsoft’s OneDrive app adds OneDrive to the Document Picker interface and allow access to files from within any installed app instantly.
It should be noted that, within iOS 8, an app still can’t directly access the storage container of a different app. For this to happen, the app that initially creates the files must mark its container public so that the Document Picker can discover its files. Any apps with public containers then show up in Document Picker if the app trying to access the files supports the requisite file type.
The Document Picker actually runs “out-of-process” so that it can see all public containers. It also serves as the security guard for the doorway between apps. When accessing a file within another app’s public container, it’s the other app’s Document Picker (not the host or calling app) that performs the actions on the file, like moving it to the host app for editing. When this happens, the Document Picker returns a “security scoped” URL informing the kernel and host app that it’s allowed to open and edit the file.
The Storage Provider extension also handles the file state while sharing the file between apps, including file bookmarking, so when you leave a document in one app, you can open it in another app and continue where you left off.