iOS cordova project - Group plugin files in folder under Plugins/
Asked Answered
E

1

8

I'm writing a cordova ios plugin, I managed to set the plugin.xml file correctly in order to work and import my plugin inside the project with

cordova plugin add myplugin --searchpath=path/to/my/plugin --save

command. What I'd like to do now is to group all the plugin files inside a folder.

For example, having these 2 files (snippet from plugin.xml)

...
<source-file src="src/ios/MyPlugin.m" />
<source-file src="src/ios/MyPlugin.h" />
...

I'd like to group them under MyPlugin folder, inside the iOS project Plugins folder:

MY_PROJECT
 |-- www/
 |-- Staging/
 |-- Classes/
 |-- Plugins/
 | |-- MyPlugin/ <!-- HERE -->
 | | |-- MyPlugin.m
 | | |-- MyPlugin.h
 | |-- SomeOtherPlugin.m
 | |-- Foo.h
 |-- Other Sources/
 |-- Resources/
 |-- Framework/
 |-- Products/

Right now, cordova's CLI plugin manager seems to throw any plugin file inside the Plugins folder, despite the plugin they belong to.

Is there anything equivalent to Android's target-dir attribute for iOS? Any hint?

Thanks in advance

Evetta answered 8/7, 2016 at 8:3 Comment(0)
B
4

First , based on the official document : ios also support <source-file src="src/ios/MyPlugin.m" target-dir="xxxxx"/> , however cordova just copy the file to "xxxxx" folder in the file system , which could not be reflected to Xcode project structure.

Actually what you want is to specify "Group" for ios source file , while unfortunately , currently it seems cordova doesn't support it

Bigot answered 20/10, 2017 at 7:4 Comment(1)
That's a shame for Cordova!Gav

© 2022 - 2024 — McMap. All rights reserved.