I want get values of all cells in my collection view but I have differents sections and my collection view is it not so all cells visible , when I try obtain the values , the cell visible obtain values with success but when I try obtain the values for the rest cells show the error:
unexpectedly found nil while unwrapping an Optional value
My code is
func getValueCells() {
for section in 0..<numberOfYears {
for row in 0..<3 {
let index = IndexPath(row: row, section: section)
let cell = myCollection!.cellForItem(at: index) as! CircularCell
print(cell.lblPercent.text)
}
}
}
The index is correct , any help?