Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 843
BeNdErR Avatar asked Jul 08 '16 08:07

BeNdErR


People also ask

Where is the file saved by cordova file plugin on IOS?

There are two valid locations to store persistent files on an iOS device: the Documents directory and the Library directory. Previous versions of the plugin only ever stored persistent files in the Documents directory.

How do I uninstall cordova plugins?

Removing plugins 'cordova plugin remove cordova-plugin-console' => Removes the console plugin from the project and deletes its entry from config. xml and package. json.


Video Answer


1 Answers

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

like image 130
storm wang Avatar answered Oct 13 '22 20:10

storm wang