riyaz
riyaz

Reputation: 1103

Create custom cordova/phonegap plugin to use a swift library

I have no idea if Cordova can handle what I need. I have a very specific requirement. I am an iOS developer and I have developed a swift library to be used for iOS development. But, now what I need is to create a Cordova plugin so that my library can be used in any Cordova projects.

I am not sure how to do it. I have no knowledge in javascript.

I did a bit of googling and found out the libraries Cordova uses to access Camera, contacts etc is exactly similar to what i am looking for.

For instance in cordova,

     listContacts: ->
    options = new ContactFindOptions()
    options.filter = '';
    options.multiple = true
    fields = ["id", "photos", "name", "phoneNumbers"]
    navigator.contacts.find(fields, @onSuccess, @onError, options)

onSuccess: (contacts) ->
    console.log contacts.length

onError: (error) ->
    console.log error

Like wise i need to let Cordova developers be able to use my swift library methods.

Is it even possible? Any help appreciated.

Upvotes: 0

Views: 202

Answers (1)

Nidhin Joseph
Nidhin Joseph

Reputation: 10227

Creating a plugin for Cordova is well documented in the cordova docs. It will guide you on how to build as well as publish a plugin for Cordova.

Upvotes: 1

Related Questions