Using clang* I could do
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// ...
#pragma clang diagnostic pop
However this does not work in swift.
So how to do suppress warnings in Swift?
Using clang* I could do
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// ...
#pragma clang diagnostic pop
However this does not work in swift.
So how to do suppress warnings in Swift?
EDIT: below instruction is for "deprecated declarations" warning. If you want to suppress different warnings then you should use flag relevant for the warning. Most of you probably use Clang, and it's warning flags can be found here. So if you want to suppress for example
-Wunused-argument
you will write it with "no":-Wnounused-argument
.If you want to disable compiler warnings then go to Project -> Target -> Build Settings and add flag with no prefix to other warning flags:
If you want to disable warnings for separate file: Go to Project and pick relevant Target -> Build Phases -> Compile Sources and flag separate file:
This works for Xcode 10.2+ and Swift 5
Manual fix:
Add
-w -Xanalyzer -analyzer-disable-all-checks
to the problematic file from Xcode > Project > Targets > Compile Sources > Double click the file where you want to turn off warnings.Cocoapods Fix:
If you're trying to suppress warnings from a problematic pod, you can automatically suppress all warnings from the dependency with the
inhibit_warnings
flag in your podfile: