I searched the whole internet but only found solutions for Swift 2 or outdated Xcode versions which doesnt help me :/ Also Im very new to Xcode and Swift, so please excuse that.
I want the user to input some numbers in several UITextFields and then press a "calculate" button which shows the result in a UILabel.
What I tested so far:
Convert input data to Integer in Swift
Swift calculate value of UITextFields and return value
So my code looks really poor so far. Nothing worked so thats all I have and the comment shows how I want it to be:
import UIKit
class ViewController: UIViewController {
//elements from the viewcontroller
@IBOutlet weak var input1: UITextField!
@IBOutlet weak var input2: UITextField!
@IBOutlet weak var calculate: UIButton!
@IBOutlet weak var output: UILabel!
//calculation
//Just simple math like
//output = input1 + input2
//or output = (input1 + 50) + input2
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Thank you for helping me out =)