Skip to content

TextField binding not updating on iOS17 #2716

Answered by stephencelis
marioradonic asked this question in Q&A
Discussion options

You must be logged in to vote

@marioradonic How did you rule out this behavior in vanilla SwiftUI? If I use a vanilla observable object instead of a store I can reproduce the exact same behavior:

class Model: ObservableObject {
  @Published var text = "" {
    didSet {
      if text == "123" {
        text = ""
      }
    }
  }
}

struct ContentView: View {
  @ObservedObject var model = Model()
  
  var body: some View {
    VStack {
      Text(model.text)
      TextField("Title", text: $model.text).textFieldStyle(.plain)
    }
  }
}

Because this appears to be a vanilla SwiftUI behavior and not a bug in TCA, I'm going to convert to a discussion, where workarounds may be discussed.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@marioradonic
Comment options

Answer selected by marioradonic
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
apple bug Something isn't working due to a bug on Apple's platforms.
3 participants
Converted from issue

This discussion was converted from issue #2714 on January 19, 2024 19:16.