what's the easiest way to add the value of two text fields to equal a sum to a label

前端 未结 4 1000
误落风尘
误落风尘 2021-01-29 14:17

what\'s the easiest way to add the value of two textField to equal a sum to a label.
Here are the text fields and label I am using:

@IBOutlet we         


        
4条回答
  •  [愿得一人]
    2021-01-29 15:05

    If you have numbers on there use this:

    if let num1 = Double(f1TextField.text!), let num2 = Double(f2TextField.text!) {
        speedLabel.text = "\(num1 + num2)"
    }
    

提交回复
热议问题