To create a button for this purpose, you need a class that adopts the protocols UIResponder and UIKeyInput. The required variable hasText and method deleteBackward are not used so you can just ignore them.
class ScanTextResponder: UIResponder, UIKeyInput {
init(title: Binding<String>) {
_title = title
}