I am new to iOS and Swift 3. I had this error:
fatal error: unexpectedly found nil while unwrapping an Optional value
on this line:
cell!.nameField.text = eventNameArray[indexPath.section];
Code:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
var cell:MainPageTableViewCell?
if normalTable == self.normalTable {
cell = normalTable.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as?MainPageTableViewCell
cell!.nameField.text = eventNameArray[indexPath.section];
cell!.messageField.text = eventMessageArray[indexPath.section];
return cell!
}