I'm trying to pass data from a ViewController to a custom UITableViewCell but it's not working. When I print data from ViewController.swift everything is in tact but when I print data from CustomCell.swift the array is empty. Here is my code:
ViewController.swift
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as! CustomCell
cell.data = data[indexPath.row]
return cell
}
CustomCell.swift
class CustomCell: UITableViewCell {
var data = [CKRecord]()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
println(data)
}
}