UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Odd background colour showing behind SwiftUI View on rotation of UIViewController with a UIHostingController / SwiftUI view

Forums > SwiftUI

I have a UIKit application that I'm adding SwiftUI to, so I'm using the UIHostingController and UIViewController mechanism via the Storyboard to add them.

Everything is working correctly (as per this tutorial: https://sarunw.com/posts/swiftui-view-as-uiview-in-storyboard/)

EXCEPT that when I rotate, I get a coloured view appearing behind everything. Here's a video of it running in the simulator:

https://youtube.com/shorts/3OMZKfmafSg?feature=share

Here is a stack article on it, but none of these suggestions actually worked:

https://stackoverflow.com/questions/71644516/white-flashing-during-orientation-change-even-with-black-background-swiftui

Does anyone have anything that can help?

2      

I have the same Issue. Please tell me did you find a solution?

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.