Writing a Cordova plugin for iOS

There are a tons of articles out there to help you in writing a plugin. Cordova’s documentation is detailed and very helpful too, but it’s easy for you to get buried under the documentation and go right past the nifty quirks of the framework. Here’s my few tips which may come handy for you when writing a cordova plugin:

  • If you know a little bit of Objective-C syntax, it will help. It depends upon the kind of plugin you writing. If your plugin is going to dip down in the native iOS world, then Objective-C knowledge is a must. However, I had to do a very trivial thing in the plugin, so I got by fine.
  • Read and learn from other cordova plugins. There are a ton of plugins and reading their code will definitely help you in creating a successful plugin yourself.
  • Use Xcode to run your hybrid application. I can see people raising their eyebrows to that statement, but, the latest Xcode has command line tools and cordova leverages them heavily. That means, I could develop the application, run, test it in emulator without ever opening Xcode. But, with plugins, you want to run the application through Xcode to see errors on the native side.
  • Lastly, plugin.xml is the metadata file, similar to gemspec file in the Ruby world. plugin.xml allows one to write config that ends up getting used by Xcode, so make sure you have the correct interface name that you’d like to access from the javascript side.
  • And that’s it. Surely, you will stumble upon some yourself.

About andhapp

Namastey (Hello) Stranger, This is not the geekiest blog on the planet yet it is not the dumbest one either. I am a small time developer who likes to explore new technologies. I usually program in Java, Groovy and Ruby and take keen interest in the surrounding geeky developments.
This entry was posted in Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>