In Xcode's build settings, I found two settings under "Apple Clang - Warnings - All languages":
Unused Values
Unused Variables
But setting those to "No" did not change anything. How do I get rid of warnings like this?
Variable 'foo' was never used; consider replacing with '_' or removing it
They show up in work-in-progress code with stuff commented out and I don't want to fix them. They (along with some other warnings) prevent me from using the Xcode command "Jump to Next Issue". I want "Jump to Next Error" (a way to skip the warnings), but it doesn't seem to exist.
With a handful of exceptions, individual warnings in general cannot be disabled in Swift. One way to silence this warning in particular without replacing it with _ or removing it is to explicitly use and discard it. For example:
var value = 1
_ = value // will suppress the 'never used' warning
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).
I don't think there is a way to turn off unused variable warnings apart from replacing them with "_".
There is a bug ( SR-2848 ) reported for Unused Variables
Okay, thanks guys. I see the comment in the bug that Franklin linked to - it explains why they don't want to add toggleable warnings, because it leads to language dialects. That makes sense.
In that case, I want "Jump to Next Error" in Xcode.