hey. i am trying to make a hangman game and I want to make a grid of buttons for the letters. I did that with a enum but now my problem is I can't figure out for to return the letters value, inside the button actions. so I can later use them in the game
enum letters:String {
case a = "a"
case b = "b"
case c = "c" ...
}
let buttons: [[letters]] = [
[.a, .b, .c, .d, .e, .f, .g],
[.h, .i, .j, .k, .l, .m, .n],
[.o, .p, .q, .r, .s, .t, .u],
[.v, .w, .x, .y, .z] ForEach(buttons, id: .self) {row in
HStack{
ForEach(row, id: .self) {item in
Button(action: {
//what to put here to return the letter as string?
}, label: {
Text(item.rawValue)