[TIMOB-28304] iOS: Enabling swift in Objc based module is failing while building
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-02-02T15:24:41.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 9.3.2, Release 10.0.0 |
| Components | iOS |
| Labels | module_build, swift |
| Reporter | Vijay Singh |
| Assignee | Vijay Singh |
| Created | 2020-12-23T23:09:23.000+0000 |
| Updated | 2021-02-02T15:25:01.000+0000 |
Description
In Objc based module if we add swift file and build, it is failing with error -
error: using bridging headers with module interfaces is unsupported.
The reason is that we are using [BUILD_LIBRARY_FOR_DISTRIBUTION=YES](https://github.com/appcelerator/titanium_mobile/blob/c3de1e1b9029f6cc9bed9162dde27ff5058c6835/iphone/cli/commands/_buildModule.js#L575) for building module. Ideally it should be used when we build for framework. For static libraries it should be default. Some details can be found [here](https://handyopinion.com/xcode-error-using-bridging-headers-with-module-interfaces-is-unsupported/) and [here](https://swift.org/blog/library-evolution/) .
PR - https://github.com/appcelerator/titanium_mobile/pull/12372 How to test - 1. Create a Objc based module or use the existing Objc based module e.g. ti.nfc 2. Open ti.nfc.xcodeproj in Xcode. 3. Add a swift file in the project. 4. On showing alert 'Would you like to configure an Objective-C bridging header?', select 'Create Bridging Header' button. 5. Now build the module using CLI. It should build the module without error.
merged to master for 10.0.0 target. Backport PR for 9_3_X is in progress (for potential 9.3.2 release)
merged to 9_3_X for potential 9.3.2