I'm trying to make an app that multiplies a number for a price that can be decimal or not. For example 3 * 3.50.
I'm using Swift 3. I searched for several topics here but could not add this feature to my app.
My code looks like this:
@IBOutlet weak var valueBreja1: UITextField!
@IBOutlet weak var quantityBreja1: UITextField!
@IBOutlet weak var totalBreja1: UILabel!
@IBAction func calcBreja1(_ sender: Any) {
let a = Int(valueBreja1.text!)
let b = Int(quantityBreja1.text!)
let Answer = a! + b!
totalBreja1.text = "R$\(Answer)"
}
I wanted to show the value with decimal number after multiplication.