title: Getting locale with NSNumberFormatter in iOS and Swift
body: <p>I'm trying to make an application that receive the input from two UITextFields, multiplies them and gives back the product in a third UITextField. </p>
  
  <pre><code>import UIKit
  
  class ParallelogramSurfaceArea: UIViewController {
  
      @IBOutlet weak var sideA: UITextField!
      @IBOutlet weak var height: UITextField!
      @IBOutlet weak var surfaceArea: UITextField!
  
      @IBAction func calculate(sender: AnyObject) {
  
              let aText =  (sideA.text! as NSString).doubleValue
              let hText = (height.text! as NSString).doubleValue
  
              let a = round(10000 * aText)/10000
              let h = round(10000 * hText)/10000
              let sa = round(10000*(a * h))/10000
  
              sideA.text = "Side A = \(a) m"
              height.text = "Height = \(h) m"
              surfaceArea.text = "Surface Area = \(sa) m²"
      }
  </code></pre>
  
  <p>The problem is that on the decimal pad the ',' appears instead of the '.' because of the locale settings resulting in an error in the calculation. How can I fix this with NSNumberFormatter? Any suggestions for improving the <code>class ParallelogramSurfaceArea</code>?</p>