UIKit strange layout bug in iOS14

This is a strange bug I am encountering on iOS 14 and it is very hard to replicate in a stand alone project. I sometimes get the following glitch when my app loads on iOS 14 betas that never happened on previous iOS versions. The attached gif shows the issue.
Code Block
[GIF](https://i.stack.imgur.com/qvaE8.gif)


What I have is a subview called topPanel.
Code Block
@IBOutlet weak var topPanel: UIView!

It is set to white color with alpha 1 in the Storyboard. 


Then in viewDidLoad, I set it to clear color as follows:
Code Block
topPanel.backgroundColor = UIColor.white.withAlphaComponent(0.0)


Next, in other places in code, such as viewDidLayoutSubviews:


Code Block
> override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
self.cameraUI = CameraUIType.singleCam
}



}
Code Block
private var topPanelState = TopPanelState.none {
didSet {

Code Block
private var cameraUI = CameraUIType.singleCam {
didSet {
DispatchQueue.main.async {
self.topPanelState = .none
}
switch topPanelState {
case .none:
topPanel.isHidden = false //Setting this to true doesn't cause bug
...
}
}
Any ideas where this glitch could be coming from?





```
Dear UIKit Engineers, This is a bug with XCode projects not having UISceneDelegate (pre iOS 13) and is very simple to reproduce. Just have an XCode project without UISceneDelegate and have a hidden subview with white background in the Storyboard. Unhide this subview in viewDidLoad and see the glitch on startup in landscape mode.

I have filed feedback FB8400870. Is there any known workaround? This is causing very bad app load experience.
FYI, the problem is more accurately described in the following SO link with images:

https://stackoverflow.com/questions/63418881/uikit-glitch-on-ios14-for-projects-without-uiscenedelegate
UIKit strange layout bug in iOS14
 
 
Q