Swift Bridging Header - New Target
Asked Answered
J

2

6

I have an objective-c project with one class implemented in Swift. The project has with two targets: A and B. For both of them the Xcode created the bridging header files, A-Swift.h and B-Swift.h, and the app builds and runs both targets without any issue.

I've added two new targets, C and D (this time no bridging header files were created). If I build A and B there is no issue, but if I build C and D the build isn't completed because it can't find the B-Swift.h.

Target C is just a duplication of A, and D a duplication of B, with of course some properties updated in the plist file.

Any suggestion?

Jerky answered 6/7, 2016 at 8:12 Comment(0)
P
3

I suggest using the same generated header name for different targets. Otherwise you'd need to include all generated headers in each .m file or change the import based on target you run. You can go to Build Settings -> Swift Compiler General and change Objective-C Generated Interface Header Name to A-Swift.h for all your targets.

Pheni answered 2/12, 2016 at 11:20 Comment(0)
A
0

In order to make all the targets use the same bridging header, you need to change the Objective-C Bridging Header value. I did NOT have to change the Objective-C Generated Interface Header Name

under your Build Settings > Search swift compiler> Under Swift Compiler-General> Change the value of Bridging header. Repeat the process for all the existing targets.

Antipyrine answered 27/1, 2017 at 19:36 Comment(1)
What if I need to ignore some libraries in one of the targets? Any idea on that?Weatherley

© 2022 - 2024 — McMap. All rights reserved.