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.