I am trying to set the background color of UIView programmatically. The code I am using is
UIView.appearance().backgroundColor = .blue
It works fine when I open the app, but as soon as I interact with it, the entire screen becomes a block of the selected color: