I am having the same issue when using a picker in a form.Supporting Imageshttps://i.stack.imgur.com/nzIyW.jpghttps://imgur.com/a/lOgItMHFrom left to right:Image(uiImage: ) displayed in a form section in a HStackImage in a Picker with Image(uiImage: )Image in a Picker with Image(systemImage: )You can see that in 2 & 3 it automatically applies a tint/mask (maskColor) of black (when using non dark mode and tint/mask of white when in dark mode).This must be default behaviour of SwiftUI to add a mask to any image inside the view shown when going to the selection list of a picker in a form.I am unable to work out how to remove this mask/tint off the image and display it in colour.Section(header: Text("Wind")) {
Picker("", selection: $addAdjustmenViewModel.selectedWindDirection) {
ForEach(0..<addadjustmenviewmodel.winddirection.count, id:="" \.self)="" {<br=""> WindPickerView(direction: self.addAdjustmenViewModel.windDirection[$0]).tag($0)
}
.navigationBarTitle("Wind Direction")
}.navigationBarTitle(navigationTitle)
}import SwiftUI
import UIKit
struct WindPickerView: View {
var direction: String = "N"
private var windImage: UIImage!
init(direction: String) {
self.direction = direction
windImage = LocalImageManager.sharedInstance.windDirectionImages(direction: self.direction)
//print("end init")
}
var body: some View {
HStack {
Image(uiImage: windImage).resizable().frame(width: 32, height: 32, alignment: .center).padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 0))
Spacer()
Text(direction)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 8))
}
}
}
struct WindPickerView_Previews: PreviewProvider {
static var previews: some View {
WindPickerView(direction: "N")
}
}
Post
Replies
Boosts
Views
Activity
If you compile the app on Xcode 11 on Big Sur it should be fine. If you were to compile the app in Xcode 12 on Big Sur it won't work.