The details are not the details. They make the design. Playing with is so much fun and challenging. One of the things I came across is using gradients with collection views. Collection Views Adding gradient to a or is as simple as adding it to any other view. We had a detailed discussion over it in the . [UICollectionView](https://developer.apple.com/documentation/uikit/uicollectionview) [UICollectionViewCell](https://developer.apple.com/documentation/uikit/uicollectionviewcell) previous article Another challenge is, what if we need to add gradient to a on selection and remove it when the is de-selected. UICollectionViewCell UICollectionViewCell So, do you find that challenging? Let’s see step-by-step how we can achieve that. Pre-requisites Before we start coding, let’s see what we already have 🧐 and how can we use that to solve our problem statement. — In the we had a detailed discussion on how to get that working. Adding gradient to a view previous article — we have already discussed how handles that. Changing the **UICollectionViewCell’s** properties based on its selection state Here isSelected Combining the above 2, now we’re left with “adding the gradient to cell when it is selected and removing it when it is de-selected”. We’re already halfway there, just need to put our knowledge in the right place. 🎯 Now that we know what actually needs to be done, let’s begin with some coding. Let’s code it.. Our custom , should implement 2 things, UICollectionViewCell A that we want to apply on each cell gradient Override to handle selection state changes, i.e. isSelected That’s it. That’s the only code we require to get that working. Sample Project You can download the sample project from . here Promotions Don’t forget to read my other articles: Everything about Codable in Swift 4 Everything you’ve always wanted to know about notifications in iOS Coding for iOS 11: How to drag & drop into collections & tables All you need to know about Today Extensions (Widget) in iOS 10 UICollectionViewCell selection made easy..!! Feel free to leave comments in case you have any doubts.