I updated Xcode to Version 8.3 (8E162) and in my unit test file I have this warning:
Implicit import of bridging header 'myframe-Bridging-Header.h' via module 'myframe' is deprecated and will be removed in a later version of Swift
on this line:
@testable import myframe
How to fix this warning?
Alternatively, you can create a bridging header yourself by choosing File > New > File > [operating system] > Source > Header File. Edit the bridging header to expose your Objective-C code to your Swift code: In your Objective-C bridging header, import every Objective-C header you want to expose to Swift.
As the error states, bridging headers are not allowed in Frameworks. The Importing Code from Within the Same Framework Target section of the Mix & Match apple documentation hints at this. As they say, you need to "In your umbrella header file, import every Objective-C header you want to expose to Swift".
That article helped me to fix the warning: https://bugs.swift.org/browse/SR-3801
I selected:
chain the import by adding #import "App-Bridging-Header.h" to any existing unit test bridging header you have
So it has nothing to do with that line per se (which threw me for a loop) and you are not supposed to change it. What is happening is that the @testable import
would normally automatically import the module bridging header as well and now it does not anymore.
Like SR-3801 says the solution is to either:
- explicitly import the App bridging header into your unit tests (via a build setting) or
- chain the import by adding #import "App-Bridging-Header.h" to any existing unit test bridging header you have
I already had a Test-Bridging-Header.h
where I added #import "MODULE-Bridging-Header.h"
as part of solution 2 which I think is preferable. Now the test bridging header chains in the module bridging header and the warning disappears.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With