I'm used to C# and java, swift is definitely a different beast!
I've been struggling for hours trying to get this to work. It is something so simple as well! I just want to get the text from a UITextField and turn it into an Int and then send the Int to a UILabel!!
So many answers on the internet haven't worked at all!
This is the error i'm getting now. (using Xcode 8.2.1 and Swift 3.0.2)
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var firstTextField: UITextField!
@IBOutlet weak var secondTextField: UITextField!
@IBOutlet weak var sumLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func calculateButton(_ sender: UIButton) {
let firstNumber = Int(firstTextField.text!)
let secondNumber = Int(secondTextField.text!)
//ERROR: 'init' has been renamed to 'init'(describing:)'
sumLabel.text = String(firstNumber + secondNumber)
}
}
Thanks guys!