Estou com o seguinte problema:
Value of type 'String?' has no member 'Int'
Qual o motivo do erro e qual a solução?
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)")
}
}