One Watch Kit App from multiple targets

This has happened to me a few times now. I’m working on an iOS app with multiple targets. Each target is designed for a specific customer. I want a single watch kit app that serves and adapts to the hosting iOS app. Sounds simple. Actually it is. Bit it is not obvious. Here’s how you do it.

First create the WatchKit app as you normally would, associating it with whichever target is most sensible. The steps are;

1. Do: File > New > Target 2. watchOS > WatchKit App > Next 3. Give the target a name relating to the hosting iOS App target 4. Select the Target you want to from the “Embed in Companion Application” dropdown 5. Click finish 6. Write it

Next, when you’re ready to add the watch kit app to another target, just like the above create a new watch kit target (steps 1 – 5 from above).

Like before, this will create two new file groups (which will end with “WatchApp” and ” WatchApp Extension”). Next, delete all the files created with the possible exception of the the PLIST or assets folder in order to customise the app on a target by target basis.

Next, go into the file groups for the first Watch App. Set the target memberships to include the new target (with the possible exception of the PLIST and the assets folder).

You should now be able to build and the second target, using the code from the first target.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s