I hope there is a solution to this. I am writing a money counting app. Here is a code snippet from the View body where the keyboard toolbar is created. Each cashCountRow has a denomination of cash, like $10, a TextEdit to enter the number counted, and a total. I have placed 3 buttons, one to dismiss the keyboard, one to advance focus to the next row, and one to move focus to the preceding row. That all works fine.
The problem is that after leaving the screen with this on it, those buttons remain on the keyboard, even when I want nothing. They are greyed out, somehow. If I visit a page before this keyboard toolbar is set up, the keyboard is clear of toolbar buttons as I want, but once I have brought up the keyboard for the cash count rows, those buttons hang around.
Group {
ForEach(CoinNote.allCases.reversed(), id: \.self) { cn in
ForEach(data.cashCountRows.filter( { $0.nc.coinNote == cn } )) { cashCountRow in
cashCountRow
.focused($focusIndex, equals: cashCountRow.index)
.frame(height: data.calcNcSize.height)
}
TotalRow(data: data, title: cn.name, total: totals[cn])
.padding(.bottom)
}// ForEach
}// Group
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Button("Done") {
focusIndex = nil
}
Spacer()
Button("Prev") {
focusIndex = ((focusIndex ?? 0) - 1).mod(data.cashCountRows.count)
}
Button("Next") {
focusIndex = ((focusIndex ?? 0) + 1).mod(data.cashCountRows.count)
}
}
}// toolbar