Hi, I'm in the process of updating my dilution calculator app to be fully done in SwiftUI. I'm trying to rewrite the old part of UIKit to SwiftUI. Can I get some help on how to do this?
Here is the code form UIKit:
@IBAction func button(_ sender: Any) {
self.ContainerSizeTextField.resignFirstResponder()
self.DilutionRatioTextField.resignFirstResponder()
let firstValue = Double(ContainerSizeTextField.text ?? "0") ?? 0.0
let secondValue = Double(DilutionRatioTextField.text ?? "0") ?? 0.0
let thirdValue = Double(1)
let outputValue = Double(secondValue + thirdValue)
var outputValue1: Double = 0
if outputValue > 0.00000001 || outputValue < -0.0000000001 {
outputValue1 = Double(firstValue / outputValue)
}
let outputValue2 = Double(firstValue - outputValue1)
let c:String = String(format:"%.1f", outputValue1)
let d:String = String(format:"%.1f", outputValue2)
TotalProductLabel.text = " \(c)"
TotalWaterLabel.text = " \(d)"