TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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.