I am trying to get a UIView
to cover the full screen so that when I press a button, I can apply a dark mode theme. The code I found works in the tutorial I have seen, but not in my application. I think Swift may have updated the language, making the solution obsolete.
if let window = UIApplication.shared.keyWindow {
let blackView = UIView()
blackView.backgroundColor = .black
view.addSubview(blackView)
blackView.frame = window.frame
}