Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Candidate has non-matching type UITableView?

Xcode says that "Candidate has non-matching type UITableView....."Anyone know how to figure this out?

func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) 
-> Int {
        return dataSource[section].count
       }

func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath!) 
-> UITableViewCell? {
        let cell = tableView!.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)                   as             UITableViewCell

        if let path = indexPath{
            let currentString = dataSource[path.section][path.row]
            cell.textLabel?.text = currentString
        }
        return cell
    }
like image 849
Dennis Avatar asked Jun 25 '26 05:06

Dennis


1 Answers

The function signatures have changed. You need to update to these:

func tableView(tableView: UITableView, numberOfRowsInSection section: Int)  -> Int {

and

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
like image 197
Anthony Kong Avatar answered Jun 27 '26 22:06

Anthony Kong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!