Two int values add up to report an error in swift

this is my code:

    let num3 = num1.text.toInt()!
    var num4 = Int(num2.text!)
    let sum = num3 + num4
    

this error appears on the first line: "Value of type "String?"" The method in the first line is used in the has no member "toInt" "
textbook. If there is no mistake, I would like to know which method is better.
after the second line is used, it shows that the data type of num4 is int? Is there a problem, too?
A rookie, thank you for your advice, thank you

Nov.23,2021
Menu