'Button in For Each List

I am trying to pass information to a sheet from a button on a list. My example code always passes the "Init" string the first row you press, and after that, it shows the correct row information passed. I'm not sure why it is not correctly saving my var on the first click. Any suggestions on how to do this?

struct test_nav: View {
@State var ispresented = false
@State var rowText = "Init"

var body: some View {
    VStack {
        List{
            ForEach(0..<10) { row in
                HStack {
                    Text("row \(row)")
                    Button( action: {
                        rowText = ("row \(row)")
                        ispresented.toggle()
                    }){
                        Text("Show Sheet")
                    }
                }
            }
        }
    }
    .sheet(isPresented: $ispresented) {
        Text(rowText)
    }
}}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source