-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CB-10071: (ios) Proposal swift support #107
CB-10071: (ios) Proposal swift support #107
Conversation
This seems good, and should remove the need for people to fiddle with hook scripts or extra plugins just to get Swift working. Regarding plugins written in Swift, how do you envision they would specify the compatible Swift version? I guess they could inject it into the platform's config.xml and let the app's config.xml override it? Plugin specifies Swift 4.0 in its plugin.xml: <!-- plugin.xml -->
<plugin ...>
<platform name="ios">
<config-file parent="/*" target="config.xml">
<preference name="SwiftVersion" value="4.0" />
</config-file>
</platform>
</plugin> Application config.xml specifies Swift 4.1: <!-- config.xml -->
<widget ...>
<platform name="ios">
<preference name="SwiftVersion" value="4.1." />
</platform>
</widget> Result: Swift 4.1 |
Thanks @dpogue I did not assume that the plugin specifies its own swift version. However, as you said that, the application config.xml can override plugin's preferences. It is a good rule that the plugin has its own default swift version and the developer Anyway choosing swift version is totally developer's responsibility. |
Sounds good. Are you planning to do this for cordova-ios@5, the next major version? |
I think we should try to get this in for cordova-ios@5 |
I have found one difficulty. Assuming that there are two plugins,
pluginB's methods need to call onto pluginA's methods. In this use case, our specification is not enough. To solve this issue, pluginB would be required to have an additional obj-c header file pluginB.h
and in pluginB's
|
That still seems acceptable. It makes sense that pluginB would be required to define its dependency on pluginA, even if the process for doing that involves an extra header file. |
I have just sent two PRs. PR for cordova-ios PR for cordova-common |
I have just sent a PR for cordova-doc. |
Set status to completed
The purpose of this proposal is to support iOS plugin written by Swift.
I propose introducing two functions.
The first function will edit the
Bridging-Header.h
according to the settings defined inplugin.xml
.The second is setting the application’s Swift version according to the settings defined in
config.xml
.Note that we can specify the Swift version for the application. Plugins with different Swift version can not be imported simultaneously. This is contrary with CocoaPod libraries in which Swift version can be specified for each.