ANNOYANCE: String interpolation produces a debug description for an optional value; did you mean to make this explicit?

Xcode 8.3 demanding all optionals in string interpolation

"String interpolation produces a debug description for an optional value; did you mean to make this explicit?"

This make no sense for logging - I WANT to see nil.

Now I have to string String(describing:optional) everywhere.

Why was it taken OUT of the code


Made more annoying by the fact the Fix-it is broken.

doesnt appear half the time. You have to hit the build result multiple times to get the Fix-it menu to pop up.

Then the build item doesnt go away after I added the fix-it so kept accidentally adding Sting(describing:....) twice on top of the same code.


I thought the purpose of Swift was to add less code not String(describing: everywhere.

Replies

also noticed it this Fix-it has to fix two variable on the same line it doesnt always appear.


the menu option - Fix All In Scope - is broken - disabled even when you click on fix-it error!!!

I agree. This is extremely annoying and very un-swiftly.

Yes, this is really, really annoying. I have logging functions that specifically want to see this, so now my compilation is just littered with junk. WTH? Sigh...

Adding 20 characters to every optional string to handle a scenario that I really don't care about is about as un-Swift-y as anthing I could imagine.


Looking at my code this morning, all I see is

String(describing: )

String(describing: ), String(describing: )

String(describing: )

String(describing: )

String(describing: )

String(describing: )

Seems that we won't get rid of this, since this is how Swift 3.1 handles the conversion of optionals into strings.

Read more here: https://oleb.net/blog/2016/12/optionals-string-interpolation/