I would like to convert text (such as "3.9") to a decimal number that can be used in mathematical formulas.
Here is the part of my code which allows me to convert integers, but I'd like to convert decimal numbers as well:
import UIKit
var xa = 0
class ViewController: UIViewController {
@IBOutlet weak var xA: UITextField!
@IBAction func chargecarte(sender: AnyObject) {
xa = xA.text.toInt()!
}
}