> For the complete documentation index, see [llms.txt](https://docs.electricbolt.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.electricbolt.co.nz/getting-started/watchos-app-integration/watchos-app-extension-integration.md).

# watchOS app extension integration

watchOS apps can be developed in both Swift and Objective-C.

Appfigurate Library works in most types of watchOS app extensions.

## Prerequisites

You must perform the following before starting watchOS app extension integration:

* [watchOS app integration](/getting-started/watchos-app-integration.md) of Appfigurate Library.

## Add AppfigurateLibrary.xcframework to the watchOS app extension target

In Xcode, tap on your watchOS app extension target.

Tap the `General` tab. Tap the `+` button under the `Frameworks, Libraries` section.

Select `AppfigurateLibrary` package.

## Share the watchOS app APLConfiguration subclass with the watchOS app extension

Share the watchOS app's [<mark style="color:blue;">`APLConfiguration`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html) subclass with the watchOS app extension.&#x20;

Open your [<mark style="color:blue;">`APLConfiguration`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html) subclass (e.g. `Configuration.swift/m` file) into the Xcode editor.&#x20;

In the `Target Membership` inspection pane tick on your watchOS app extension target.

## **Setup Keychain Sharing in the watchOS app extension**

Tap on your watchOS app extension target. &#x20;

Tap the `Signing & Capabilities` tabs. Add a `Keychain Sharing` capability with a `Keychain Groups` value that will be common across the watchOS app and watchOS app extension.&#x20;

We recommend you have a `.shared` suffix on *your* Keychain Groups value.

<figure><img src="/files/v0Ei5gnEF3z6SfstPJXF" alt=""><figcaption></figcaption></figure>

## **Setup Keychain Sharing in the watchOS app**

Tap on your watchOS app target. Tap `Signing & Capabilities` tabs.&#x20;

Add a `Keychain Sharing` capability with the same `Keychain Groups` value you entered for the iOS app extension above.

<figure><img src="/files/bD05kUxXJf4XE3oARBLQ" alt=""><figcaption></figcaption></figure>

## Edit Info.plist in the watchOS app

In your watchOS app's `Info.plist` file (right click, `Open As` ‣ `Source Code`) include the `APLKeychainAccessGroup` key replacing the value `nz.co.electricbolt.appfigurateexample.shared` with *your* `Keychain Sharing`'s `Keychain Groups` value.

> `Info.plist` example

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>APLKeychainAccessGroup</key>
     <string>nz.co.electricbolt.appfigurateexample.shared</string>
     ...
```

{% hint style="warning" %}
If the `APLKeychainAccessGroup` key is not defined, then keychain access group functionality is not used. Do not specify an empty or otherwise invalid `APLKeychainAccessGroup` value.
{% endhint %}

{% hint style="success" %}
watchOS app extensions automatically use the `Info.plist` file from the containing watchOS app. You do not need to modify the watchOS app extension's `Info.plist` file.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.electricbolt.co.nz/getting-started/watchos-app-integration/watchos-app-extension-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
