I'm looking to get my variable content in my awakeFromNib function in my custom cell.
Actually, I pass my data like this :
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "question_cell", for: indexPath) as! QuestionsCell
cell.answers = ["Answer 1", "Answer 2"]
return cell
}
In my QuestionCell file, I've got my variable declared like this :
var answers = [String]()
And When I want to print my answer variable, I've got an empty array in the output console []
override func awakeFromNib() {
super.awakeFromNib()
print("HELLOOOOOOOOOOOO !!!!!!!!!!!!")
print(answers)
}
Could you please help me to solve this ? Thank you