I have created a tableview controller but its delegate methods are not getting called. I referred a few web sites and didn't came across any mistake in my code. Please help me.
class FriutsTableViewController: UITableViewController {
var fruitsList : [AnyObject] = ["We", "love", "swift"];
override func viewDidLoad() {
    super.viewDidLoad()
    let myCatalog = Catalog()
    fruitsList = myCatalog.fruits;
    //let view = ViewController()
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
    return 0
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
    return fruitsList.count
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
    var cell  = tableView.dequeueReusableCellWithIdentifier("fruitIdentifier") as? UITableViewCell
    if !cell {
        cell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "fruitIdentifier")
    }
    cell!.textLabel.text = fruitsList[indexPath.row] as AnyObject! as String!
    return cell
}
@objc func fetchFruits() {
}
Thanks in advance.
Try to
return 1 
in
numberOfSectionsInTableView.
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With