Skip to content
Discussion options

You must be logged in to vote

Hi @jkay-kim, yes something is missing from your code. You should have seen a purple warning in Xcode letting you know that something was wrong when you typed into the text field. Did you not?

To fix this you have to use the BindingReducer. We have an article in the documentation that describes this, but in your case you want this:

struct SomeFeature: ReducerProtocol {
  struct State: Equatable {
    @BindingState var someText: String = ""
  }
  
  enum Action: BindableAction {
    case binding(BindingAction<State>)
  }
  
  var body: some ReducerProtocolOf<Self> {
    BindingReducer()
    
    Reduce { state, action in 
      switch action {
      case .binding(\.someText):
        return .

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jkay-kim
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
None yet
2 participants