I create a collectionView
and I want to add shadow to every cell, I wrote this code
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! MyCollectionViewCell
cell.myLabel.text = self.items[indexPath.item]
cell.backgroundColor = UIColor.yellow
cell.layer.shadowColor = UIColor.black.cgColor
cell.layer.shadowOffset = CGSize(width: 3, height: 3)
cell.layer.shadowOpacity = 0.7
cell.layer.shadowRadius = 4.0
return cell
}
but this is the output
I want it be like this UIView with rounded corners and drop shadow?