func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let dev = devices[indexPath.item]
if dev.cuid == "3011"{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LightViewCell", for: indexPath) as! LightViewCell
let visibility = self.getStatusFor(nodeID: dev.node_id!, endpoint: dev.end_point!, devicename: dev.device_name!)
if visibility.contains("0"){
cell.LigntIMG.image = #imageLiteral(resourceName: "bulb-off")
cell.LightName.text = dev.device_name
cell.status = 0
cell.index = indexPath
cell.controlCMDs = getControlCMDS(nodeID: dev.node_id!, endpoint: dev.end_point!)
cells.append(cell)
}else{
cell.LigntIMG.image = UIImage(named: dev.menu_id!)
cell.LightName.text = dev.device_name
cell.status = 1
cell.index = indexPath
cell.controlCMDs = getControlCMDS(nodeID: dev.node_id!, endpoint: dev.end_point!)
cells.append(cell)
}
return cell
}
else if dev.cuid == "3006"{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "DimmerLightViewCell", for: indexPath) as! DimmerLightViewCell
return cell
}
return //
}
I am having two types of custom cells(LightViewCell/DimmerLightViewCell) based on the conditions i need to display any one of the two cells...... types
here i am not returning any value, ignore that error.....i need to know how to implement the the above requirement..
Thank you:)