Add the watch target
Create the watchOS app target, set its identifiers and signing, and link the AWARE framework.
If your app uses any CocoaPods plugins, open the workspace, not the project:
Create the watchOS app target
Add a new target
Choose File → New → Target…, then select the watchOS tab → App → Next.
Fill in the target options
Field Value Product Name CarpWatch(any name works, this guide usesCarpWatch)Interface SwiftUI Language Swift Project RunnerEmbed in Companion Application RunnerActivate the scheme
When Xcode offers to activate the new scheme, choose Activate.
Set the deployment target
Select the
CarpWatch Watch Apptarget → General → Minimum Deployments → watchOS 8.0 or later.
Xcode creates:
- a group
CarpWatch Watch AppcontainingCarpWatchApp.swift,ContentView.swiftand assets; - a target and a scheme of the same name;
- an Embed Watch Content build phase on the
Runnertarget.
Set the bundle identifiers and signing
The watch app's bundle identifier must be the iOS app's identifier plus exactly one component:
| Target | Bundle identifier |
|---|---|
Runner | dk.carp.myapp |
CarpWatch Watch App | dk.carp.myapp.watchkitapp |
Xcode normally gets this right when you use Embed in Companion Application. Verify it:
- under the watch target → Signing & Capabilities → Bundle Identifier;
- in the build setting
INFOPLIST_KEY_WKCompanionAppBundleIdentifieron the watch target, which must point at the iOS bundle identifier.
Set the same Team on both targets and let Xcode manage signing. With manual signing, you need a second provisioning profile for the watch app's identifier.
Warning
If this relationship is wrong, watchOS never offers to install the companion app.
Link the AWARE framework into the watch target
The AWARE framework ships inside carp_aware_package as pre-compiled binaries. Xcode already resolved them along with the plugin, so you only need to link them into the watch target.
Select the watch target
CarpWatch Watch App→ General.Add the framework
Under Frameworks, Libraries, and Embedded Content, press +, pick
carp-aware-watchfrom the list of package products, and choose Add.Leave it on Do Not Embed
The binaries are static libraries and require no embedding or signing.
This gives the watch target two AWARE watch modules, com_awareframework_ios_sensor_applewatch_shared and com_awareframework_ios_sensor_applewatch_watchOS, including the other packages they require.
Watch target only
Do not add carp-aware-watch to the Runner target. The iOS side of the plugin already links its own AWARE binaries through carp-aware-package. Adding the watch product to the app as well gives you two copies of the same modules and duplicate-symbol errors at link time.
Next step
Capabilities and permissions
Capabilities, background modes, and the privacy strings watchOS requires.