0

I use core data and mvvm in my project and one of the properties uses the Integer data type, how do I implement it in a textfield, when I use a textfield an error like this appears.

error appears "Cannot convert value of type 'Binding<Int?>' to expected argument type 'Binding'"

how to make the text field not error?

burnsi
  • 6,194
  • 13
  • 17
  • 27
Rii
  • 3
  • 2

1 Answers1

0

Try using TextField's init(_:value:format:prompt:) initialiser rather than the init(_:text:) that you are using. Maybe something like...

TextField("Jumlah Barang", value: $addItem.jumlah, format: .number) 
Azzaknight
  • 157
  • 1
  • 7