Если я раскомментирую
tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?)
Я получаю сообщение об ошибке в строке
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath)
который говорит UITableView? does not have a member named 'dequeueReusableCellWithIdentifier'
Если я разворачиваю табличное представление, ошибка исчезает, но в Objective-C мы обычно проверяем, существует или нет ячейка, а если нет, мы создаем новую. В Swift, поскольку в поставляемом шаблоне используется ключевое слово let
и разворачивается необязательно, мы не можем переназначить его, если он равен нулю.
Каков правильный способ использования dequeueReusableCellWithIdentifier в Swift?