Guides and Sample Code

Developer

App Extension Programming Guide

On This Page

App Extensions Increase Your Impact

An app extension lets you extend custom functionality and content beyond your app and make it available to users while they’re interacting with other apps or the system.

You create an app extension to enable a specific task. For example, to let users post to your social service from a web browser, you can provide a Share extension. Or, to let users catch up on their favorite team, you can provide a Today widget that displays current sports scores in Notification Center. You can even create an app extension that provides a custom keyboard that users can use in place of the iOS system keyboard.

There Are Several Types of App Extensions

iOS and macOS define several types of app extensions, each of which is tied to a single, well-scoped area of the system, such as sharing, Notification Center, and the iOS keyboard. A system area that enables extensions is called an extension point. Each extension point defines usage policies and provides APIs that you use when you create an app extension for that area. You choose an extension point based on the functionality you want to provide.

Table 1-1 lists the extension points in iOS and macOS and gives an example of tasks you might enable in an app extension for each extension point.

Table 1-1Extension points on Apple platforms

Extension point

Typical app extension functionality

Action (iOS and macOS; UI and non-UI variants)

Manipulate or view content originating in a host app

Audio Unit (iOS and macOS; UI and non-UI variants)

Generates an audio stream to send to a host app, or modifies an audio stream from a host app and sends it back to the host app

Broadcast UI (iOS and tvOS)

Broadcast Upload (iOS and tvOS)

Call Directory (iOS)

Content Blocker (iOS and macOS)

Indicate to WebKit that your ad blocking app has updated its rules

(This app extension has no user interface)

Cross-platform SpriteKit Game

Custom Keyboard (iOS)

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

Document Provider (iOS; UI and non-UI variants)

Provide access to and manage a repository of files.

Finder Sync (macOS)

Present information about file sync state directly in Finder

(This app extension has no user interface)

Game App (watchOS)

Provide an game app for Apple Watch, as described in App Programming Guide for watchOS.

iMessage (iOS)

Intents (iOS)

Intents UI (iOS)

Notification Content (iOS)

Notification Service (iOS)

Photo Editing (iOS and macOS)

Edit a photo or video within the Photos app

Share (iOS and macOS)

Post to a sharing website or share content with others

Shared Links (iOS and macOS)

Smart Card Token (macOS)

Spotlight Index (iOS)

Sticker Pack (iOS)

Today (iOS and macOS)

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

(A Today extension is called a widget)

TV Services (tvOS)

VPN (iOS and macOS)

Create clients for your business’s custom, remote-access VPN servers using the Packet Tunnel Provider or App Proxy Provider extension points.

Create content filtering for managed devices, such as for school environments, using the Filter Control Provider and Filter Data Provider extension points.

WatchKit App (watchOS)

Provide an app or a notification UI for Apple Watch, as described in App Programming Guide for watchOS.

Xcode Source Editor (macOS)

Because the system defines specific areas for app extensions, it’s important to choose the area that best matches the functionality you want to deliver. For example, if you want to create an extension that enables a sharing experience, use the Share extension point, starting with the Share Extension Xcode template.

Xcode and the App Store Help You Create and Deliver App Extensions

An app extension is different from an app. Although you must use an app to contain and deliver your extensions, each extension is a separate binary that runs independent of the app used to deliver it.

You create an app extension by adding a new target to an app. As with any target, an extension target specifies settings and files that combine to build a product within your app project. You can add multiple extension targets to a single app (an app that contains one or more extensions is called a containing app).

The best way to start developing an app extension is to use one of the templates that Xcode provides for each extension point on both platforms. Each template includes extension point–specific implementation files and settings, and produces a separate binary that gets added to your containing app’s bundle.

To distribute app extensions to users, you submit a containing app to the App Store. When a user installs your containing app, the extensions it contains are also installed.

After installing an app extension, a user must take action to enable it. Often, users can enable an extension within the context of their current task. If your extension is a Today widget, for example, users can edit the Today view in Notification Center to enable your extension. In other cases, users can use Settings (in iOS) or System Preferences (in macOS) to enable and manage the extensions they install.

Users Experience App Extensions in Different Contexts

Although each type of app extension enables a different type of task, there are some parts of the user experience that are common to most extensions. As you think about designing an extension, it’s important to understand the user experience that’s intended by the extension point you choose. At a high level, the best user experience for all extensions is quick, streamlined, and focused on a single task.

Users open your app extension by interacting with some system-provided user interface (UI). For example, a user accesses a Share extension by activating the system-provided Share button in an app and choosing the extension from the list that’s displayed.

Although most app extensions provide at least some custom UI elements, users don’t see your custom UI until they enter your extension. When users enter your extension, your custom UI can help to show them that they’re shifting into a new context. Because users can distinguish your extension from the current app, they can appreciate the unique functionality that you provide. Users’ awareness of extensions as separate entities also means that they can identify and remove extensions that misbehave or don’t perform well.

To give users a smooth transition into your app extension, you generally want to balance your custom design with the UI that’s associated with the extension point. For example, it’s a good idea to make your widget look like it belongs in the Today view. Similarly, in your Photo Editing extension, it works well to create a UI that harmonizes with Photos in iOS.