Im trying to build a weekly calendar for IOS.
The problem with that sample is code is: the usage of an dates array
let dates = ["7/10/2017", "7/11/2017", "7/12/2017", "7/13/2017", "7/14/2017", "7/15/2017", "7/16/2017"]
func spreadsheetView(_ spreadsheetView: SpreadsheetView, cellForItemAt indexPath: IndexPath) -> Cell? {
if case (1...(dates.count + 1), 0) = (indexPath.column, indexPath.row) {
let cell = spreadsheetView.dequeueReusableCell(withReuseIdentifier: String(describing: DateCell.self), for: indexPath) as! DateCell
cell.label.text = dates[indexPath.column - 1]
return cell
Filling that array with real dates from 01.01.2000 - 31.12.2099 e.g. leads to really bad performance of the app.
Does anyone know how to display the current Dates in an more elegant way?