Swift charts displaying wrong theme through UIHostingController

Hi there, I'm currently using UIHostingController to display swift charts in uikit. The problem im facing is that the UIHostingController isn't outputting the intended theme. When the simulator/phone is on dark mode the view is still in light mode. Iv'e tried to force the view to use dark mode with:

.environment(\.colorScheme, .dark)

But it doesn't seem to help. Here's how I implement the UIHostingController to my view:

let controller = UIHostingController(rootView: StatVC())
controller.view.translatesAutoresizingMaksIntoConstraints = false
addChild(controller)
controller.didMove(toParent: self)
view.addSubview(controller.view)

where StatVC() is the swiftui view which contains the swift chart.

Admin can please close this question as the problem was on me not Charts :)

Swift charts displaying wrong theme through UIHostingController
 
 
Q