Cannot convert value of type 'String?' to type 'NSString' in coercion
<p>Im trying to make this calculator for various math formulas and I'm stuck at this point. I was following this <a href="https://www.youtube.com/watch?v=-_74lanSnL8" rel="nofollow noreferrer">tutorial</a></p>

<p>Here's my code: </p>

<pre><code>import UIKit

class pythagorasViewController: UIViewController {


@IBOutlet weak var aLabel: UILabel!
@IBOutlet weak var bLabel: UILabel!
@IBOutlet weak var aField: UITextField!
@IBOutlet weak var bField: UITextField!
@IBOutlet weak var answerLabel: UILabel!
@IBAction func calculateButton(_ sender: UIButton) {
    var a = (aField.text as NSString).floatValue
    var b = (bField.text as NSString).floatValue
    var answer = sqrt(a*a + b*b)
    answerLabel.text = "\(answer)"
}

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}
</code></pre>

<p>The part where I'm getting the error is at:</p>

<pre><code>var a = (aField.text as NSString).floatValue
var b = (bField.text as NSString).floatValue
</code></pre>