Mobile
Article

A Guide to Extensions in iOS 8 and OS X Yosemite

By Enrico Sustayo

One of the common features present in every mobile platform except iOS is the ability to access an App’s features without running the App. Android calls this ‘Widgets’ and Windows Phone, ‘Live Tiles’.

Let’s be clear, extensions in iOS can be so much more that just widgets or third party keyboards. Extensions are proposed by Apple as the new method of extending any functionality from any app. Apple are heralding this as the successor of OS X’s Services feature.

Apple is so serious about extensions, that in OS X they are bringing many of the features that were part of Dashboard to extensions. I wouldn’t be surprised if Apple remove Dashboard completely from future versions of OS X, but I think this will happen later rather than sooner. Currently, if you wrote Dashboard widgets in the past, you should now port it to use the extension framework.

There are 7 supported extension types in iOS 8 and OS X Yosemite, 6 of them available for iOS and 4 of them for OS X. We will take a look at all of them in this article.

Note that Apple has indicated that in future versions of iOS and OS X, they may add new extension types. [1]

Extension points in iOS and OS X. Source: Apple.

Extension point

Example app extension that helps users:

Today (iOS and OS X)

Get a quick update or perform a quick task in the Today view of Notification Center

(A Today extension is called a widget)

Share (iOS and OS X)

Post to a sharing website or share content with others

Action (iOS and OS X)

Manipulate or view content within the context of another app

Photo Editing (iOS)

Edit a photo or video within the Photos app

Finder (OS X)

Present information about file sync states directly in Finder.

Document Provider (iOS)

Provide access to and manage a repository of files.

Custom Keyboard (iOS)

Replace the iOS system keyboard with a custom keyboard for use in all apps

Today (iOS and OS X)

The Today extension type (also called a widget) is one of the most common types of extension that people might have seen on other mobile platforms. This has been one of the most requested features for a long time.

A Today extension allows developers to place a custom view at the bottom of the notification centre that can be accessed anywhere by swiping down from the top of the screen. This is useful for apps that show a small piece of important information such as sports scores, stock prices, or exchange rates. You can put a more complex functionality into a Today extension, for example PCalc included a mini calculator in their latest update.

Share (iOS and OS X)

In the first version of iOS (then iPhone OS), Apple introduced a way to share web pages and photos without having to copy and paste. In fact, copy and paste was not available OS wide. This was the beginning of the share button that Apple carried forward all the way to iOS 7. In iOS 5 Apple added the ability to share to Twitter, in iOS 6 share to Facebook, and in iOS 7 AirDrop and Reading List.

Before iOS 8, there was no way for a third party developer to have their apps included as one of the share options. Apple has only been adding new share sources little by little with every OS update. Of course in the long run, this was never a scalable option for Apple. What if in the middle of iOS life cycle, a new social network became popular? What if Facebook or Twitter changed their policy drastically in the middle of iOS life cycle?

So Share the extension is a natural fit for social networks and other web services that have been wanting to be included in iOS for years. [2]

Action (iOS and OS X)

The Action extension sits close to the share extension, in both OS X and iOS they are accessed from the same button. In older versions of iOS, we have already been using the action extension for things such as Add to Reading List, Add to Home Screen, Copy, and Print.

The Action extension is used to view or transform content within the context of another app. One of the best examples of this, as shown in the WWDC keynote, is a translation app that has an Action extension that can translate content in Safari to another language. Another clever application of this is for a password manager like 1Password to write an Action extension to be run on Safari pages to fill passwords.

Photo Editing (iOS)

The Photo Editing extension is something that a lot of people have been expecting in iOS. Ever since Instagram launched, I have heard from many friends asking me: “Can I use Instagram filters in my Photos app?” (answer: “Of course not, you have to post to Instagram to get the filtered photos”). Their idea of Instagram (and other photo editing iOS apps) is similar to Photoshop on the desktop. You open a photo, edit and then you get the result.

While it’s not exactly like that in iOS, the Photo Editing extension will allow users to edit photos right inside the built in Photos app with any editing tools they’ve installed. This is a much better experience for users, since all of their photos live in the Photos app and they don’t have to leave the app to edit their photos.

Finder Sync (OS X)

Finder Sync is an OS X only extension. It’s also the only OS X exclusive extension in this release. Finder Sync extension can be used to register folders to be monitored, and also be synced with remote data sources. If you’re using Dropbox you probably have a pretty good idea of how the Finder Sync extension works.

You can achieve pretty much what Dropbox is doing with the Finder Sync extension. This includes displaying a custom contextual menu in a certain folder and displaying badges on the files inside it. You can also add custom buttons to Finder toolbars.

Document Provider (iOS)

The Document Provider extension is the iOS counterpart of the Finder Sync extension. With the Document Provider extension in iOS, you can provide your own files when the app tries to save or open a file in a document based app.

This does not necessarily give a user access to your entire file system, but it at least allows the users to save, open, and edit documents from your own cloud storage. This hints that Apple is now OK with letting users use third party cloud storage services. This might mean that people may move away from iCloud, since they are not forced to save their documents in iCloud anymore.

Custom Keyboard (iOS)

It’s clear why this extension is available only on iOS, as it’s the only platform out of the two that doesn’t ship with a hardware keyboard. I am quite surprised that this was included this in iOS. Compared to the other extensions, I personally feel this was one of the least requested.

Custom Keyboards can provide a custom keyboard interface for users. One of the most popular examples of a third party keyboard from other platforms is Swype [3]. I am quite happy with iOS’s built in keyboard. I’ve tried using other third party keyboards and most of them are just not that easy to use and don’t offer many more features than the built in one.

Where do I start?

Before you write extensions for iOS 8 and OS X Yosemite, make sure that you carefully think about how a user will use your extensions. Remember that if the user delete your app, your extension will also be removed from the system. When you write extensions, make sure that it is something that users will really use. Make sure that they can associate your extension with your app. If they forget that your app provides certain extensions, they will not realize that they’ve removed your extensions by removing your app.

In Xcode 6, creating extensions is straightforward. In the same way that Apple provides template for Core Data, Storyboard, and Table View Controllers, they also provide very good starting points for extensions. The extensions templates can be accessed by using to File > New > Target… in Xcode 6:

Creating an extension in Xcode 6

So that’s extensions. It’s a very big feature in iOS 8 and OS X Yosemite. It will be the foundation of further functionality that we will see in future iOS and OS X releases. For more detailed information, check out the App Extension Programming Guide by Apple. This is a very big topic to cover, but I hope that this blog post will serve as a gentle and broad introduction to Extensions.


  1. Which may in the future include an extension to run apps on Apple Watch.  ↩

  2. Hello, Pinboard.  ↩

  3. Which they probably will port to iOS.  ↩

More:

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Mobile, once a week, for free.