0

help me please, when I add this line of code:

 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    // #warning Incomplete implementation, return the number of rows
    return (list.items?.count)!
}

I'm trying with this code to display number of items in list.

  • Why are you force unwrapping a value from optional chaining? Remember, the `!` operator means "crash here is nil". – rmaddy Mar 29 '17 at 23:34
  • but, without it shows error –  Mar 29 '17 at 23:35
  • You should read http://stackoverflow.com/questions/32170456/what-does-fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-valu to better understand the issue. Also read the chapters on Optionals and Optional Chaining in the The Swift Programming Language book. – rmaddy Mar 29 '17 at 23:39

0 Answers0