I am currently learning Swift and have encountered a problem with SwiftUI for which I cannot find a solution. When I create a picker with text and an image, for example, I am unable to format them. I have also tried using resizable() but it still doesn't work. Additionally, the text cannot be edited. Is this intentional or am I just doing something wrong? (The PickerStyle is Menu)
import SwiftUI
struct LanguagePicker: View {
@Binding var selection: Country
var body: some View {
Picker("Sprache", selection: $selection) {
ForEach(Country.allCases) { country in
HStack {
Text(" \(country.language)")
country.image
.resizable()
.frame(maxWidth: 10, maxHeight: 10)
}
.tag(country)
}
}
.font(.title2)
.pickerStyle(.menu)
.tint(.black)
}
}
#Preview {
LanguagePicker(selection: .constant(.japan))
}

When I click on the image, the picker works with the desired sizes:

Pickerdoes not allow you to apply your own styling. It looks for a label and an image in the items you supply and shows these in its own native ways. In the collapsed form, the image comes first, but in the menu list, the label comes first. I assume the large red circle in your screenshot is the Japanese flag? Try using smaller images to build thePickeritems. To change the font size, these posts might help: for the collapsed form, for the menu items