I have a tableview that is responsible for showcasing a contacts list, however whenever I attempt to load the tableview my project crashes with the error |Fatal error: Unexpectedly found nil while unwrapping an Optional value| this is what my code regarding loading the data looks like as of right now
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell",
for: indexPath) as!TableClass
let contacts = contact[indexPath.row]
cell.Name.text = contacts.name
cell.Picture.image = UIImage(data: contacts.image!, scale: 1) //this is the line of code that seems to make my project crash
return cell
}
I've also attempted to use a case method such as this:
if case let cell.Picture.image = UIImage(data: contacts.image!, scale: 1) {
print("Hello")
}
However when I attempt this the project still crashes and Xcode point to the if case let
line and reports the same error