Using now onReceive instead of creating a Binding

This commit is contained in:
dankito 2020-07-17 19:58:40 +02:00
parent af1e155106
commit 89d6ea1002
1 changed files with 5 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import SwiftUI import SwiftUI
import BankingUiSwift import BankingUiSwift
import Combine
struct AddAccountDialog: View { struct AddAccountDialog: View {
@ -19,16 +20,12 @@ struct AddAccountDialog: View {
var body: some View { var body: some View {
let textValueBinding = Binding<String>(get: {
self.enteredBank
}, set: {
self.enteredBank = $0
self.findBank()
})
return Form { return Form {
Section { Section {
TextField("Bank code", text: textValueBinding) TextField("Bank code", text: $enteredBank)
.onReceive(Just(enteredBank)) { newValue in
self.findBank()
}
} }
Section { Section {