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:


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


Does anyone have anything that can help?


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


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.