Swift : How to set Custom UICollectionViewCell as circle?
<p>I've custom <code>UICollectionViewCell</code> that contains <code>UILabel</code> and <code>UIImage</code>.
I want to set the cell in circular format.</p>

<p><strong>Note:-</strong> <code>sizeForItemAtIndexPath</code> cannot be changed due to AutoLayout.</p>

<p>Below is code that I've used :</p>

<pre><code>func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,sizeForItemAtIndexPath indexPath:NSIndexPath ) -&gt; CGSize {

          return CGSize(width: (self.objKeypadCollectionView.frame.size.width/3)-10, height: (self.objKeypadCollectionView.frame.size.height/4)-10)
    }

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {

        let objKeypadCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("idKeypadCollectionViewCell", forIndexPath: indexPath) as! KeypadCollectionViewCell

        if (self.numberArray[indexPath.item])=="asda" {
            objKeypadCollectionViewCell.lblNumber.text = ""
            objKeypadCollectionViewCell.imgPrint.hidden = false
        }
        else if (self.numberArray[indexPath.item])=="Derterel" {
            objKeypadCollectionViewCell.lblNumber.text = self.numberArray[indexPath.item]
            objKeypadCollectionViewCell.imgPrint.hidden = true
        }
        else {
            objKeypadCollectionViewCell.imgPrint.hidden = true
            objKeypadCollectionViewCell.lblNumber.text = self.numberArray[indexPath.item]
            objKeypadCollectionViewCell.layer.borderColor = UIColor.lightGrayColor().CGColor
            objKeypadCollectionViewCell.layer.borderWidth = 1
            objKeypadCollectionViewCell.layer.cornerRadius = objKeypadCollectionViewCell.frame.size.width/2
        }
        return objKeypadCollectionViewCell
    }
</code></pre>

<p><a href="https://i.stack.imgur.com/JWfbX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JWfbX.png" alt="Screenshot 1"></a></p>

<p><a href="https://i.stack.imgur.com/Atrtw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Atrtw.png" alt="Design screen"></a></p>