SwiftUI Image(uiImage:) converts colored image to black and white

I have a data object that dynamically changes the UIImage assigned to one of its instance variables, but when showing this image in SwiftUI, it's always black and white. The following sample code shows the difference between the same image, but using first the native constructor Image(systemName:) and then Image(uiImage:).

When using AppKit and Image(nsImage:) this issue doesn't happen.

import SwiftUI
import UIKit

struct ContentView: View {
    @State var object = MyObject()
    
    var body: some View {
        Image(systemName: "exclamationmark.triangle.fill")
            .symbolRenderingMode(.palette)
            .foregroundStyle(.white, .yellow)
        Image(uiImage: object.image)
    }
}

class MyObject {
    var image = UIImage(systemName: "exclamationmark.triangle.fill")!
        .applyingSymbolConfiguration(.init(paletteColors: [.white, .systemYellow]))!
}

#Preview {
    ContentView()
}
SwiftUI Image(uiImage:) converts colored image to black and white
 
 
Q