Whether it is tremendous to disregard faucets on an already chosen row, you should use onChange(of: choice)
.
// modify the Checklist with this, not the record rows
.onChange(of: choice) { metropolis in
if isFocusedFromTextField {
from = metropolis
} else {
to = metropolis
}
}
In any other case, think about using a Button
because the record rows as an alternative. This nonetheless maintains the selectable nature of the record.
Button {
if isFocusedFromTextField {
from = metropolis
} else {
to = metropolis
}
} label: {
// change this with a extra sophisticated view in order for you...
Textual content(metropolis)
}
// - fashion the button to look extra like a Textual content in order for you
// - eliminate the choice @State for those who do not want it
// - for those who do want the choice, you may fashion the buttons in a different way
// relying on chosen state, utilizing listRowBackground and so forth.