import Foundation
import SwiftUI
struct SampleComponent: View {
@Binding var value: Decimal
var body: some View {
return Text("\(value)")
}
}
Gives me the error:
Instance method 'appendInterpolation' requires that 'Decimal' conform to '_FormatSpecifiable'
This works fine in a playground though:
import Foundation
var d: Decimal = 4.5
print("\(d)")
Any idea what's going on or how to fix it?
Not exactly sure why it gives this error, but one solution is to cast it to a String:
Text("\(value)" as String)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With