Converting String to Int with Swift

前端 未结 30 1741
小鲜肉
小鲜肉 2020-11-22 06:59

The application basically calculates acceleration by inputting Initial and final velocity and time and then use a formula to calculate acceleration. However, since the value

30条回答
  •  我寻月下人不归
    2020-11-22 07:07

    //  To convert user input (i.e string) to int for calculation.I did this , and it works.
    
    
        let num:Int? = Int(firstTextField.text!);
    
        let sum:Int = num!-2
    
        print(sum);
    

提交回复
热议问题