UILabel возвращает nil

xcode
ios
swift3

#1
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell2", for: indexPath) as! Cell2
    
    var user: User
    
    
    if shouldShowTheResult
    {
        user = self.filtered[indexPath.row]
        
    }
    else
    {
        
        user = MessageController.users[indexPath.row]
        print(user.name)
    }
    
    cell.nameLabel.text = user.name <<-- Здесь возвращает nil
    
    
    return cell
}

#2

Оутлет привязали к лейблу?


#3

Да, я проверял привязку


#4

Есть какие-либо добавления к вопросу?


#5

user не может быть null в этом случае.

func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?

let cell = tableView.dequeueReusableCell(withIdentifier: "Cell2", for: indexPath) as! Cell2

почему так? сделать делать надо “as?”.