Skip to content

Instantly share code, notes, and snippets.

@mauriciord
Last active August 29, 2015 14:12
Show Gist options
  • Save mauriciord/dbf2f45bce44af8aa218 to your computer and use it in GitHub Desktop.
Save mauriciord/dbf2f45bce44af8aa218 to your computer and use it in GitHub Desktop.
Código retirado do livro que está com erro
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let row = indexPath.row
let meal = meals[row]
var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: nil)
cell?.textLabel?.text = meal.name
return cell!
}
@guilhermesilveira
Copy link

        var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: nil)

        cell.textLabel?.text = "guilherme"

        return cell

É o do último Xcode (6.2 beta). A variável textLabel virou um optional, isso?

@mauriciord
Copy link
Author

UITableViewCell? does not have a member named 'textLabel' na linha:

cell.textLabel?.text = "guilherme"

return cell

Value of optional type 'UITableViewCell?' not unwrapped; did you mean to use '!' or '?' ?

@mauriciord
Copy link
Author

Meu Xcode é o 6.1, devo atualizar para o 6.2 ?

@guilhermesilveira
Copy link

Atualiza sim, pois é só questão de tempo para parar de funcionar na sua máquina...

@mauriciord
Copy link
Author

Deu certo ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment