I followed this post and put inside my custom UITableViewCell SummaryCell
the UITableView detailTableView
But now I'm getting the error:
Type 'SummaryCell` does not conform to protocol `UITableViewDataSource`
If anyone could tell what I'm doing wrong & how to fix this I would greatly appreciate it!
Code for SummmaryCell
:
class SummaryCell: UITableViewCell, UITableViewDelegate, UITableViewDataSource{
@IBOutlet weak var dayOfWeek: UILabel!
@IBOutlet weak var totalSpent: UILabel!
@IBOutlet weak var totalSpentView: UIView!
@IBOutlet weak var heightOfMainView: NSLayoutConstraint!
@IBOutlet weak var detailTableView: UITableView!
var data: [Expense] = [Expense]()
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
detailTableView.delegate = self
detailTableView.dataSource = self
//create data array
let calendar = NSCalendar.currentCalendar()
let dateComponents = NSDateComponents()
dateComponents.day = 14
dateComponents.month = 5
dateComponents.year = 2015
dateComponents.hour = 19
dateComponents.minute = 30
let date = calendar.dateFromComponents(dateComponents)
data = [Expense(amountSpent: 60), Expense(amountSpent: 20, date: date!), Expense(amountSpent: 40, date: date!, function: Function.Social, category: Category.Fun, subcategory: Subcategory.Events)]
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("detailCell") as! DetailTableViewCell
return cell
}
}
What my summaryCell
looks like :