After upgrading to Xcode 11 Beta 4, I starting seeing an error when using String(format: , args)
with @State
property. See code below. Second Text
line throws an error:
Expression type 'String' is ambiguous without more context
while Text
s 1, 3, and 4 work just fine.
struct ContentView : View {
@State var selection = 2
var body: some View {
VStack {
Text("My selection \(selection)") // works
Text("My selection \(String(format: "%02d", selection))") // error
Text("My selection \(String(format: "%02d", Int(selection)))") // works
Text("My selection \(String(format: "%02d", $selection.binding.value))") // works
}
}
}
I realize this is Beta software, but was curious if anyone can see a reason for this behavior or is this simply a bug. If this can't be explained, I'll file a radar.