I want to create a gradient background layer in each row of a UITableView in Swift. In the cellForRowAt function I have this piece of code to draw the gradient layer. 

```
guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? PlayerTableViewCell else { fatalError("The dequeued cell is not an instance of PlayerTableViewCell") }

// set background color for the cell
let newLayer = CAGradientLayer()
newLayer.colors = [UIColor.black.cgColor, UIColor.darkGray.cgColor ]
newLayer.frame = cell.frame
cell.layer.addSublayer(newLayer)
cell.layer.insertSublayer(newLayer, at: 0)

```

When I run this code, only the first entry in the table has the gradient layer, the other cells have the default background. 
Do I need to add something?

[Missing background gradient color in table cells](https://i.stack.imgur.com/d9DVr.png)