Closed mmartinez23 closed 4 months ago
I too just stumbled upon this exact same issue. If you run the init command with version 0.12.0 like below, you will find it creates everything as expected. Something must have been broken in 0.13.0 (confirmed by running with 0.13.0 specifically, and issue exists).
Running this should be a suitable workaround until it is fixed:
npm init @capacitor/plugin@0.12.0
Looks like #96 is the place these template files were dropped. Probably a good place to start looking for whoever has time 😁
That worked! Thank you
Just noting I would probably leave this issue Open too so someone from their team can look into this. It definitely shouldn't be broken in the latest
version of the package 😁
Glad the above workaround was sufficient enough for you though! 💪
What is "broken" are the docs, Capacitor 6 adds SPM support and the recommended plugin structure for working on SPM projects is the one created by latest release of the plugin.
For future reference in case someone sees this. I managed to get it working with the latest release of the plugin. As stated by @jcesarmobile the docs are not the guide to follow if you are using the latest release. At least not the part of needing to open a .xcworkspace to develop the plugin and to make it work with the app you install it on. You just work on the swift file and install the plugin on the app. Also for anyone that reads this make sure to import it on the main app as "from "custom-plugin"", I had other errors because the intellisense on Visual Studio Code was importing it using "from "custom-plugin/src".
Thank you @jcesarmobile and @fordkilleen for your time and help.
I encountered the same issue, and being my first iOS plugin created from scratch, and not a native iOS developer, I did not know where to start with no Xcode project already configured. Just by comparing the structure with other plugins, I realized something was missing. The documentation is not broken, it's completely missing this essential part of creating a new plugin. @mmartinez23 how did you manage to get it working with the latest release? And that worked only by downgrading to 0.12.0, or how is this fixed?
Hi,
Im following the Capacitor custom plugin guide, I see that in the documentation it states: "Next, open echo/ios/Plugin.xcworkspace in Xcode". But the plugin I just generated with npm init @capacitor/plugin@latest does not have any file or folder that could be opened as a project in Xcode. Only the Sources and Tests folder and a .gitignore. Is there anything Im missing or did I misunderstood the documentation? The android folder seems to have been generated so I can open it in Android Studio as a folder.
Node version: 20.8.1 NPM: 10.1.0 Capacitor: 6
Current structure that was generated: