WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

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      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.