[ 
https://issues.apache.org/jira/browse/CB-10071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611441#comment-16611441
 ] 

ASF GitHub Bot commented on CB-10071:
-------------------------------------

erisu closed pull request #107: CB-10071: (ios) Proposal swift support
URL: https://github.com/apache/cordova-discuss/pull/107
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/proposals/ios-swift-plugin-support.md 
b/proposals/ios-swift-plugin-support.md
new file mode 100644
index 0000000..f92ec78
--- /dev/null
+++ b/proposals/ios-swift-plugin-support.md
@@ -0,0 +1,70 @@
+# Swift Plugin Support
+- Status: Completed
+
+## Overview
+
+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 in `plugin.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.
+
+
+## Bridging-Header
+
+Introduce the `BridgingHeader` type attribute value in the `header-file` tag 
in plugin.xml
+
+ex.
+```
+<header-file src="src/ios/Hoge-Bridging-Header.h" type="BridgingHeader" />
+```
+
+This specification is similar to the proposal 
https://issues.apache.org/jira/browse/CB-10071 where the value is 
`SwiftObjcBridgingHeader`. The specification here is little simpler.
+
+When the `type` attribute is set to `BridgingHeader`, the `Bridging-Header.h` 
file, located in cordova-ios template is updated as
+
+```
+#import <Cordova/CDV.h>
+#import "Plugins/cordova-plugin-xxxx/Hoge-Bridging-Header.h"
+```
+
+This new feature, i.e. updating `Bridging-Header.h` file, is working at 
+
+`after plugin add`
+`after plugin rm`
+
+
+Do not introduce any other auxiliary files such as ios.json to manage plugins' 
BridgingHeader files.
+Therefore if two plugins specify the sample BridgingHeader file, although this 
hardly occurs, `updated Bridging-Header.h` becomes as follows,
+
+```
+#import <Cordova/CDV.h>
+#import "Plugins/cordova-plugin-xxxx/Hoge-Bridging-Header.h"
+#import "Plugins/cordova-plugin-xxxx/Hoge-Bridging-Header.h"
+```
+
+After removing one plugin, this becomes
+
+```
+#import <Cordova/CDV.h>
+#import "Plugins/cordova-plugin-xxxx/Hoge-Bridging-Header.h"
+```
+
+## Select application swift version
+
+Introducing the `SwiftVersion` preference tag option in `config.xml`.
+
+ex.
+```
+<preference name="SwiftVersion" value="4.1" />
+```
+
+This specifies the Swift version of the application, by calling the Xcode 
module. This is set after the following command(s):
+
+`cordova prepare`
+
+Do not introduce any other auxiliary files such as ios.json to manage which 
swift versions is fixed or not.
+Therefore updating swift version is performed every time after doing `cordova 
prepare` if the above preference exists in `config.xml`.


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Proposal: feature to merge Swift bridging headers
> -------------------------------------------------
>
>                 Key: CB-10071
>                 URL: https://issues.apache.org/jira/browse/CB-10071
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-lib
>            Reporter: Shazron Abdullah
>            Priority: Major
>              Labels: backlog
>             Fix For: [email protected]
>
>
> In cordova-ios-4.x we have a Bridging-Header.h file for Cordova classes, so 
> this will enable Swift plugins.
> However, this is not adequate for Swift plugins that have to use third-party 
> Objective-C libraries for their plugin itself. The plugins need to add the 
> bridging headers to the app's Bridging-Header.h file (by appending to the 
> file we already have).
> Firstly, we should never modify the app's Bridging-Header file, it should 
> remain static (modifying this will be problematic for every `cordova prepare` 
> cycle, for multiple plugins). 
> We should have a feature to merge multiple bridging header files together, 
> and point the SWIFT_OBJC_BRIDGING_HEADER value in build.xcconfig to it.
> An example of a Cordova plugin that has this problem: 
> https://github.com/alongubkin/phonertc
> This could be an optional attribute in the `<header-file>` tag in plugin.xml:
> https://cordova.apache.org/docs/en/4.0.0/plugin_ref/spec.html
> I propose something like-this:
> {code}
> <header-file src="Foo.h" type="SwiftObjcBridgingHeader" />
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to