Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state surfing (episode 90) #52

Closed

Conversation

finestructure
Copy link

@finestructure finestructure commented Mar 22, 2020

This is an example PR to highlight the changes to integrate "State Surfing" into the Prime Time app.

Screenshot 2020-03-22 at 18 24 03

NB: The PR may seem large but the actual changes required are very limited. The relatively large diff count is due to the state surfing dependency HistoryTransceiver depending on a library called CompArch, which is a copy of the "ComposableArchitecture" module embedded in the the app project. It is a drop-in replacement and in order for the app to work with HistoryTransceiver it needs to be switched over to CompArch. This is only necessary until there is an official Composable Architecture library that both projects can use.

The actual changes require are threefold:

  • Make AppState adopt the StateInitializable protocol (which is essentially Codable)
  • Make ContentView adopt the StateSurfable protocol
  • Replace rootView: ContentView(...) with HistoryTransceiverView<ContentView>(...) in SceneDelegate and start the transceiver

With those changes in place, the app will broadcast state changes. Use the Historian app to view those changes and surf to any state.

@finestructure
Copy link
Author

Note that I'm targeting episode 90 here, because my CompArch copy of ComposableArchitecture lags behind and doesn't support Environment yet.

@finestructure
Copy link
Author

I was just tidying up my Github and saw this was still open. I'll go ahead and close it as it was really just intended as an example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant