Extending your Cordova iOS application with a native plugin
How to do it...
In this recipe, we will create a native iOS plugin for our Cordova application using command-line tools, as suggested by Cordova. We will implement the plugin for Android that we created in the previous recipe to work with iOS:
- Change the working project to
helloplugin
, openplugin.xml
, and add information about the new iOS platform:<platform name="ios"> <config-file target="config.xml" parent="/widget"> <feature name="Hello"> <param name="ios-package" value="HWPHello" /> </feature> </config-file> <header-file src="src/ios/HWPHello.h" target-dir="HelloPlugin"/> <source-file src="src/ios/HWPHello.m" target-dir="HelloPlugin"/> </platform> </plugin>
- Then create two blank files,
HWPHello.h
andHWPHello.m
, inside thesrc...