How to suppress warnings in Swift 3?
EDIT: The below command is for the "deprecated declarations" warning. If you want to suppress various warnings, you must use the warning flag. Most of you are probably using Clang, and these warning flags can be found here . So if you want to suppress, for example -Wunused-argument
, you write it with no ": -Wnounused-argument
.
If you want to turn off compiler warnings, go to Project β Task β Build Settings and add a prefix to the flag without another warning flags:
If you want to disable the warning for a single file: Navigate to the project and select Target β assembly Phases β Compile sources and mark a file:
source to share
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 disable warnings.
Cocoapods Fix:
If you are trying to suppress warnings from a problematic module, you can automatically inhibit_warnings
all warnings from a dependency using inhibit_warnings
in your subfile:
pod 'Kingfisher', '~> 4.6', :inhibit_warnings => true
source to share