Apple Watch, Multiple Targets, and Common Target Applications Watchkit Extension / Watckit

I am currently working on projects that have many (10+) goals. This is an application with a white brand, each goal is intended for the client, all goals have the same code, but compile different resources (especially .xcsassets).

I would like to integrate the Apple Watch in my project, just to include notifications on the watch. To do this, add 2 goals: an extension and an application for Watchkit. (nota: the WatchKit App target will be associated with the same .xcassets as the associated iPhone application to inherit from the AppIcon).

Although this is normal for a project with several objectives, in my case it is really impractical. Lots of new files created by .plist in my subversion folders, and make the list of goals really huge.

Can these two additional goals be shared with all my clients? Perhaps this is possible using scripts so that the TargetKit App / Extension targets match (updating the target name, package ID, etc.) Automatically the target of the / iOs schema?

Any idea would be more than welcome.

+7
ios watchkit apple-watch target
source share
2 answers

You can manage the target layer, depending on the clock, using configurations and user settings to manage the package ID. Suppose you have 10 goals, and you need to create an application for viewing, and then define the package identifier for each main application in the user preferences in the project settings (not for the target), which will allow you to extend this name to your goal along with two goals hours.

For example, for goal A, you defined the package identifier as BUNDLE_A_ID as com.company.a , you can use $(BUNDLE_A_ID) as the package identifier in the application’s target program, $(BUNDLE_A_ID).watchapp or $(BUNDLE_A_ID).watchappextension in the targets of your hours, so you do not need to determine the package identifier for each goal, your definition of these parameters will be associated with one place (project setup).

0
source share

CAUTION: make a copy of your project or create a new branch to try this solution.

I found how to fix it. I assume that you have an iOS app running, and the Apple watch app is working, and you need to add more apps to view Apple without repeating the code.

Step 1: File / New / Target Select the WatchOS tab, and then select the WatchKit App. Select the application you want to associate with this new Apple Watch application. Click "Next"

Step 2: Look at the new folders created for the new Apple Watch app and delete all * .swift and * .storyboard

Step 3: Select the .storyboard and .swift files of your first Apple Watch application, which worked originally, and you must assign them a new and old target membership. In the future, all of your watch application files should have selected goals.

enter image description here

0
source share

All Articles