tmdvs / TDBadgedCell

TDBadgedCell is a table view cell class that adds a badge, similar to the badges in Apple's own apps
www.tmdvs.me
MIT License
1.43k stars 182 forks source link

'UITableViewCell' does not have a member named 'badgeString' #64

Closed datomnurdin closed 9 years ago

datomnurdin commented 9 years ago

My project using Swift. The problem is I got this error message when I trying to set badgeString.

Error message

/Users/MNurdin/Documents/iOS/XXXXX/Controllers/ViewController.swift:55:9: 'UITableViewCell' does not have a member named 'badgeString'

My code

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("BuzzCell", forIndexPath: indexPath) as! UITableViewCell //1
        cell.textLabel?.text = buzzs[indexPath.row]
        cell.badgeString = "130990"; //error message here
        return cell
    }

I already import the library via bridging header. Please advice. Thank you.

tmdvs commented 9 years ago

You're using UITableViewCell instead of TDBadgedCell

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> TDBadgedCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("BuzzCell", forIndexPath: indexPath) as! TDBadgedCell //1
        cell.textLabel?.text = buzzs[indexPath.row]
        cell.badgeString = "130990"; //error message here
        return cell
    }
datomnurdin commented 9 years ago

But I got another error message

/Users/MNurdin/Documents/iOS/xxxxx/Controllers/ViewController.swift:12:1: Type 'ViewController' does not conform to protocol 'UITableViewDataSource'

My code

import UIKit
import TDBadgedCell

class BuzzChannelDetailViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{

/* -- */

}