Hi, I'm trying to make a second UIWindow above the main window but it is not showing, this is the code in appDelegate:
var window2:UIWindow?
func applicationDidFinishLaunching(_ application: UIApplication) {
window2?.windowLevel = UIWindowLevelAlert
window2?.isHidden = false
window2?.frame = UIScreen.main.bounds
window2?.backgroundColor = UIColor.blue
}When checking with:
print(UIApplication.shared.windows.count)It printed 2 but there was no extra window seen.
And when I deleted the initial window in appDelegate, the whole screen became black(no window displayed).
I tried searching online but couldn't find any solution. Can anyone help?
Thanks.
Hi,
I don't see any code which creates the window.
var window2:UIWindow? -- declares a window, but don't create one.window2?.windowLevel = UIWindowLevelAlert
window2?.isHidden = false
window2?.frame = UIScreen.main.bounds
window2?.backgroundColor = UIColor.bluesince window2 is nil nothing happens here.
Dirk