Skip to content

ViewState and ViewAction #152

Answered by stephencelis
ibrahimkteish asked this question in Q&A
Discussion options

You must be logged in to vote

@ibrahimkteish Scoping a view store's state (e.g., to ViewState) is important to avoid recomputing the view hierarchy too often. SwiftUI observes the view store as an ObservableObject based on its state. If you don't scope the view store to just the state a given view needs, performance may suffer, especially in the outer layers of your app, where more global state is available to your store. In isowords you'll see that most of our scoping to ViewState occurs in the outer layers of the app. At leaf views that don't pass the store any further, we are less apt to need to scope.

We talked about it most recently in this episode: https://www.pointfree.co/episodes/ep151-composable-architecture-…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ibrahimkteish
Comment options

Answer selected by ibrahimkteish
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