I have the following problem:
Value of type 'String?' has no member 'Int'
What is the reason for the error and what is the solution?
class ViewController: UIViewController {
@IBOutlet var nameField: UITextField!
@IBOutlet var happinessField: UITextField!
@IBAction func add() {
if nameField == nil || happinessField == nil {
return
}
let name = nameField!.text
let happiness = happinessField!.text.Int() // Erro aqui
if happiness == nil {
return }
let meal = Meal(name: name!, happiness: happiness!)
print("eaten: \(meal.name) \(meal.happiness)")
}
}