github pointfreeco/swift-composable-architecture 0.14.0

latest releases: 1.16.0, 1.15.2, 1.15.1...
3 years ago
  • Changed: FormAction and Reducer.form have been renamed to BindingAction and Reducer.binding based on community feedback and the more general, non-form-based use cases. Migration path: FormAction and Reducer.form have been deprecated and Xcode can automatically migrate them to their newer names.

    // before:
    
    enum SettingsAction {
      case form(FormAction<SettingsState>)
    }
    
    let settingsReducer = Reducer<
      SettingsState, SettingsAction, SettingsEnvironment
    > { state, action, environment in
      switch action {
      ...
      case .form:
        return .none
      }
    }
    . form(action: /SettingsAction.form)
    
    TextField(
      "Display name",
      text: viewStore.binding(keyPath: \.displayName, send: SettingsAction.form)
    )
    
    // after:
    
    enum SettingsAction {
      case binding(BindingAction<SettingsState>)
    }
    
    let settingsReducer = Reducer<
      SettingsState, SettingsAction, SettingsEnvironment
    > { state, action, environment in
      switch action {
      ...
      case .binding:
        return .none
      }
    }
    .binding(action: /SettingsAction.binding)
    
    TextField(
      "Display name",
      text: viewStore.binding(keyPath: \.displayName, send: SettingsAction.binding)
    )

Don't miss a new swift-composable-architecture release

NewReleases is sending notifications on new releases.