In my macOS SwiftUI app I've been able to write code like this:
Text("Yl: \(self.local.y, specifier: "%0.f")")
Which I thought meant Swift finally had support right in the interpolation for printf-style format specifiers.
But I just tried to use in a Playground
print("Took \(end - start, specifier: "%0.f") s")
and I get
error: extra argument 'specifier' in call. I tried googling this but everyone who talks about formatting in string interpolation seems to have older articles. But as I write this, I've discovered what I think is going on. That form of string interpolation is only available in
LocalizedStringKey, is that right?
Wouldn't it make sense to just add this to
ExpressibleByStringInterpolation and make it part of the standard library?