Skip to content

Binding Issue #3446

Answered by bradhowes
bradhowes asked this question in Q&A
Discussion options

You must be logged in to vote

Here's the code that works now based off of the FocusState feature in the CaseStudies app:

import ComposableArchitecture
import SwiftUI

private let readMe = """
  This demonstrates how to make use of SwiftUI's `@FocusState` in the Composable Architecture with \
  the library's `bind` view modifier. If you tap the "Sign in" button while a field is empty, the \
  focus will be changed to the first empty field.
  """

@Reducer
struct FieldEditor {
  @ObservableState
  struct State: Equatable, Identifiable {
    let id: UUID
    var value: String
  }

  enum Action: Equatable {
    case valueChanged(String)
  }

  var body: some ReducerOf<Self> {
    Reduce { state, action in
      switch ac…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bradhowes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant