Michael
Michael

Reputation: 33297

PhoneGap/Cordova App based on Swift Project

PhoneGap/Cordova for iOS is currently based on an ObjectiveC project.

How can I run a PhoneGap/Cordova app based on a Swift project?

Upvotes: 1

Views: 3956

Answers (2)

KVISH
KVISH

Reputation: 13178

The other answer works but it is manual.

You can automate how you convert a project to swift from Cordova's output. Take a look at this project:

https://github.com/akofman/cordova-plugin-add-swift-support

That project has a hook that runs after platform add and it will add a bridging header as well as the proper settings to make the project work with Swift code. You can use it as a plugin.

Upvotes: 1

Connor
Connor

Reputation: 64644

Cordova-ios is built with Objective-C, and I don't believe that's going to change any time soon. You can use Swift and Objective-C in the same project though, so nothing is stopping you from writing iOS plugins in Swift. You will have to add a bridging header though. You can see an example of a Swift cordova plugin here.

Upvotes: 2

Related Questions