I have a simple SwiftUI view where I create a Image view using a UIImage. The issue is that the Image created with the UIImage is not switching to the dark or light mode when the color scheme changes. It works correctly only if the entire view is reloaded. It works as expected if I use create the image directly with the image name.
struct ContentView: View {
var body: some View {
HStack {
VStack {
Image("my-image")
Text("Image")
}
VStack {
Image(uiImage: UIImage(named: "my-image")!)
Text("Image+uiImage")
}
}
}
}
The image itself is in a xcasset catalog
result is this (note the right image not changing when the appearance changes but only after restarting the app)

