2

The TCA guys provide a [Case Study] (https://github.com/pointfreeco/swift-composable-architecture/blob/main/Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-SharedState.swift) for shared state using the ReducerProtocol. I read the case study and nothing sinks in.

I understand the new ReducerProtocol. I understand I can use an ObservedObject with dependency injection. But I just can't fathom how to get plain-vanilla shared state working.

Would love to see some code to help me understand the simplest possible implementation of shared state with the new ReducerProtocol . . .

Small Talk
  • 747
  • 1
  • 6
  • 15
  • what do you mean by shared state in another word, here in the example they have shared the same sate with both counter and profile ! – YodagamaHeshan Mar 18 '23 at 01:54
  • Hi YodagamaHeshan, they have an example. But provide little context, especially as how to manage shared state with the new ReducerProtocol. It appears a new dedicated Reducer is necessary for each property of shared state, that a computed property updates the individual shared properties, and that three separate reducers are run to handle two shared properties. – Small Talk May 20 '23 at 18:48

0 Answers0