Reputation: 449
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?
Upvotes: 6
Views: 3210
Reputation: 133
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.
Upvotes: 0
Reputation: 66
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.
Upvotes: 3