I want to update a UILabel within a UICollectionViewCell every second, which UICollectionView function should I be using for this?
The UILabel is coded in this way.
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
cell.dayCountLabel.text = dayCount(Globals.datesArray[indexPath.item])
}
And receives data in this way.
func dayCount (dayCount: String) -> String{
let day = dayCount
let date2 = NSDate()
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd MMMM yyyy hh:mm a"
let date1: NSDate = dateFormatter.dateFromString(day)!
let diffDateComponents = NSCalendar.currentCalendar().components([NSCalendarUnit.Day], fromDate: date1, toDate: date2, options: NSCalendarOptions.init(rawValue: 0))
let difference = String("\(abs(diffDateComponents.day))")
return difference
}
Sorry for the rookie question.