I have a 3rd party framework that I have imported into my project, and it is causing compiler warnings to show up from issues in its header files. I do not want to have to change the 3rd party code, as it will likely change in the near future. I found this post:
Disable warnings in Xcode from frameworks
Which talks about how to turn off warnings on a per-file or per-project basis, but I am not certain how to do this for a framework. This is because the files are technically there but Xcode does not show them in the compiled sources section.
Does anyone know of a way to ignore compiler warnings for an included framework?
Select your project and select your target and show Build Phases . Search the name of the file in which you want to hide, and you should see it listed in the Compile Sources phase. Double-click in the Compiler Flags column for that file and enter -w to turn off all warnings for that file.
If you want to disable all warnings, you can pass the -suppress-warnings flag (or turn on "Suppress Warnings" under "Swift Compiler - Warning Policies" in Xcode build settings).
We've fixed same problem with a 3rd party framework warnings in header files by including problematic files in our pre-compiled header (.pch) with a proper pragma mark.
i.e.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmismatched-tags"
#pragma GCC diagnostic ignored "-Wreorder"
#import <ComponentKit/CKComponentViewConfiguration.h>
#import <ComponentKit/CKArrayControllerChangeset.h>
#import <ComponentKit/CKComponentDataSource.h>
#import <ComponentKit/CKComponentBoundsAnimation.h>
#pragma GCC diagnostic pop
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