I'm trying to create a simple converter. Is there any chance I can bind Measurement() with the UI. Error says that in order to bind the Measurement in must be a string. Thank you in advance! Here is the code:
import SwiftUI
struct ContentView: View {
@State private var tCelsius = Measurement(value: 0, unit: UnitTemperature.celsius)
var fromCelsiusToFahrenheit: Measurement<UnitTemperature> {
tCelsius.converted(to: .fahrenheit)
}
var body: some View {
NavigationView {
Form {
TextField("Type the temperature", text: $tCelsius)
Text("\(fromCelsiusToFahrenheit)")
}
}
}
}