in swiftui how can I change the text color when use "menu"? I mean I need that each text in pippo will be .red color as you can see in the code, but .foregroundColor(.red) do not works thanks
var pippo = ["AAA","BBB","CCC", "DDD"]
var body: some View {
Menu {
ForEach(pippo, id: \.self) { item in
Button {
//categoriaSelezionata = categoria
} label: {
Text(item)
.foregroundColor(.red)
}
}
} label: {
HStack {
Text("Select Theme")
.multilineTextAlignment(.center)
Image(systemName: "chevron.down")
.foregroundColor(.gray)
}
.frame(maxWidth: .infinity)
.padding(6)
}
Menu {
ForEach(pippo, id: \.self) { item in
Button(item) {
// azione
}
.foregroundColor(.red)
}
} label: {
HStack {
Text("Select Theme")
Image(systemName: "chevron.down")
.foregroundColor(.gray)
}
.frame(maxWidth: .infinity)
.padding(6)
}
.menuStyle(BorderlessButtonMenuStyle()) // Prova diversi stili
.menuIndicator(.hidden) // Nasconde l'indicatore di default
}