1

I have following LazyVGrid view in my code

LazyVGrid(columns: columns) {
    ForEach(monthNames!, id: \.number) { month in
        Text(month.name)
    }
    ForEach(balances, id: \.id) { balance in
        Text(valueFormatter.string(from: balance.balance! as NSNumber)!)
            .onTapGesture {
                 print(balance.balance!)
                 editActual = true
            }
            .sheet(isPresented: $editActual) {
                ActualBalanceView(show: $editActual, year: selectedYear, month: selectedMonth, balance: balance.balance! as Decimal)
            }
        }
}

and if I tap on Text item ActualBalanceView shows always value from the first Grid column even if print command placed in .onTapGesture closure prints right value to console window. Any idea how to make ActualBalanceView showing tapped value?

Dawy
  • 770
  • 6
  • 23
  • Welcome to SO - Please take the [tour](https://stackoverflow.com/tour) and read [How to Ask](https://stackoverflow.com/help/how-to-ask) to improve, edit and format your questions. Without a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) it is impossible to help you troubleshoot. – lorem ipsum Nov 25 '22 at 18:45
  • Does this answer your question? https://stackoverflow.com/questions/66162219/swiftui-switch-sheet-on-enum-does-not-work – jnpdx Nov 25 '22 at 22:46

0 Answers0