As you do not show all the code of the tableView(_:cellForRowAt:)
method just assume you are dequeuing cells (with the method dequeueReusableCell(withIdentifier:)
and have registered you class for reusing (if you use a custom class).
With this approach the view of the cells gets reused. Meaning that if you do not re-set a property (e.g. background color) it will just use the one form the old cell.
To fix this you can easily include a else in your code and in there set the background color to white.
If you subclass the UITableViewCell
class you can the prepareForReuse()
function to clean up and e.g. reset the background color.