I'm trying to put a UIview() to cover the full screen so when i press a button i can put a dark mode theme on it. it works ok the only problem is that it does not cover the nav bar which is something i want to do i have looked up a few things i found this code it works on the tutorial i have seen but does not work now think swift have updated the language making that solution old
if let window = UIApplication.shared.keyWindow {
let blackView = UIView()
blackView.backgroundColor = .black
view.addSubview(blackView)
blackView.frame = window.frame
}