treatWarning(_:as:_:)
Controls how a specific Swift compiler warning is treated during compilation.
Declaration
static func treatWarning(_ name: String, as level: WarningLevel, _ condition: BuildSettingCondition? = nil) -> SwiftSettingParameters
- name:
The name of the specific warning to control.
- level:
The treatment level for the warning (
.warningor.error). - condition:
A condition that restricts the application of the build setting.
Discussion
Use this setting to specify whether a particular warning should be treated as a warning (default behavior) or as an error. This is equivalent to passing -Werror or -Wwarning followed by the warning name to the Swift compiler.
This setting allows for fine-grained control over individual warnings. To control all warnings at once, use treatAllWarnings(as:_:) instead.