I am trying to run a simple Table View app in swift with the iOS simulator. But the app crashes once the simulator starts.
Here is my code:
import UIKit
class ViewController: UIViewController, UITableViewDataSource,UITableViewDelegate {
var restaurantNames = ["Cafe Deaden", "Home 1", "Teakha", "cafe Loisal","petite Oyster","For Kee Restaurant","pos Atelier","Bourke Street Bakery", "Haigh's Chocolate"]
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return the number of rows in the section.
return restaurantNames.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath:
indexPath) as UITableViewCell
// Configure the cell...
cell.textLabel!.text = restaurantNames[indexPath.row]
return cell
}
}
It says thread 1 breakpoint 1.5 in var restaurantNames.I have no idea where to start troubleshooting. Any help would be great.
Thanks and Cheers