Add XCode target without ejecting from expo

I’m following this article to make an Apple Watch extension from my app. the problem is I don’t want to eject from expo. So I ran to expo prebuild -p ios and I worked with that iOS directory.

Still I don’t understand:
If I can use that directory (or do I need to use always the prebuild command)
Why can’t I build again after I ran the command again when the folder contains already a watch app target.

Is there a way to link an Apple Watch app without ejecting? I don’t want to manage that files manually…

it is possible to create new xcode targets via config plugins, there are already some plugins that do that e.g.

1 Like

Thank you for your answer.
First I tried to build the target correctly on a new project.
I ran prebuild and then I put swift files fixing errors in the Xcode project.
Now I’ve read about expo conflict/plugins. Still I don’t know how to link on the fly a watch project to the react native one without ejecting.
I’ve read your links but I can’t figure it out.

Could you please explain it, if you know more about it?

Thank you :pray:

all the step you are doing manually in native code need to be automated in javascript, so you need to create all the files xcode needs, add target to pbxproj and stuff like that

You can also check this post iOS Widget Extension on EAS Build - #5 by gaishimo-omoidasu