Duplication in values of tableView when Scrolling Swift
<p>I have a tableView to display timings of week days </p>

<p>timingsArray is used in tableView to display timings </p>

<p>timingsArray of type timingObj </p>

<pre><code>class timingObj {
    var dayNo: Int?
    var open: String?
    var close: String?
    var dayName: String?

     init(json: JSON){
        // to take data from json
    }

    init(name: String, number: Int){
        self.dayName = name
        self.dayNo = number
    }
}
</code></pre>

<p>in tableView i want to display all days and their timings, if the day does not have timing then timing cell will be empty</p>

<pre><code>let cell = tableView.dequeueReusableCellWithIdentifier("TimingsCell", forIndexPath: indexPath) as! timingCell     
            let timings = self.Details!.timingsArray
            let dayTime = timings[indexPath.row]
            cell.dayLabel.text = dayTime.dayName
            if dayTime.open != nil &amp;&amp; dayTime.close != nil {
                cell.timeLabel.text = "\(convertTimeFormat(dayTime.open!)) - \(convertTimeFormat(dayTime.close!))"
            }
            return cell
</code></pre>

<p>This is the class of the cell</p>

<pre><code>class timingCell: UITableViewCell {

    @IBOutlet weak var dayLabel: UILabel!

    @IBOutlet weak var timeLabel: UILabel!

}
</code></pre>

<p>e.g Tuesday and Thursday only have timings</p>

<p>the problem is when i scroll up and down, timing value of Tuesday gets duplicated in Wednesday, and when i keep scrolling, timing values get duplicated too in other cells</p>

<p>Any ideas? Thank you in advance</p>