Treat *some* warnings as errors in Swift? Treat *some* warnings as errors in Swift? xcode xcode

Treat *some* warnings as errors in Swift?


This isn't possible. As of Swift 4, the Swift compiler doesn't have switches to either enable/disable particular warnings or promote particular warnings to errors.

The Swift core developers expressed their reluctance to add a litany of compiler flags on several occasions on the swift-evolution mailing list. The rationale is that they want to keep a single "dialect" of Swift so that every developer works with the same language features etc.

Whether this should extend to something like particular warning flags is of course debatable, but that's the current official stance. It's definitely possible that these rules will be somewhat loosened in the future, but I wouldn't bet on it.

EDIT: As of Swift 4.2, Swift added a #warning syntax.