Contents

Configuring Your Intents UI App Extension Target

Configure your Xcode project to include an Intents UI app extension that you use to customize the Siri and Maps interfaces.

Overview

An app may have one or more Intents UI app extensions to manage the custom interfaces for its intents. Each extension has a single view controller class that provides the interface for the supported intents. To set up each Intents UI app extension, you must add a custom target to your Xcode project and configure its Info.plist file with the intents that it supports.

Add an Intents UI App Extension to Your Xcode Project

When creating your Intents app extension, you can ask Xcode to create an Intents UI extension at the same time. If you didn’t do that, you can add an Intents UI extension to your project later:

  1. Open your iOS app project in Xcode.

  2. Choose File > New > Target.

  3. Select Intents UI extension from the iOS Application Extension group.

  4. Click Next.

  5. Specify the name of your extension and configure the language and other options.

  6. Click Finish.

The Xcode template includes a storyboard and a single view controller. Siri and Maps always load and display the initial view controller in your extension’s storyboard file, so configure that view controller with your content. You’re responsible for managing all interactions between the initial view controller and the rest of your content. Typically, you add custom views to the initial view controller scene, but you might also embed child view controllers so that you can display different content for each of your intents.

Specify the Intents that Your Extension Supports

After adding your Intents UI app extension target to your project, configure the default Info.plist file provided by Xcode to specify which intents should use your custom interface. SiriKit uses the information in your extension’s Info.plist file to determine when to load your custom view controller.

  1. In Xcode, select the Info.plist file of your intents app extension.

  2. Expand the NSExtension and NSExtensionAttributes keys.

  3. In the IntentsSupported key, add a String item for each intent that your extension handles. Set the value of each item to the class name of the intent.

The NSExtensionMainStoryboard key in your Info.plist file contains the name of the storyboard containing your view controller. If you change the name of your storyboard file, remember to update the value of this key. If you prefer to create your view controller programmatically, replace this key with the NSExtensionPrincipalClass key, and set the value to the name of your view controller class.

See Also

Articles