swift-composable-architecture: WithViewStore or @ObservedObject var viewStore:. doesn't update view [iOS 13.1]
Describe the bug State updates, but view doesn’t
To Reproduce Test.zip
Expected behavior I expect view to be updated on state update inside WithViewStore
Environment
- Xcode 11.6 (11E708)
- Swift 5.2.4
- iOS 13.1
** UPD:
- Doesn’t work with TCA 0.6.0, but works fine with 0.5.0 version (If I set
Exact
version)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- Store can use @Published again As of the third beta, assign(to:) takes an `inout Publisher.Publisher`, so it no longer surfaces an escape hatch through which one could mutate a store's state. Fixes ... — committed to pointfreeco/swift-composable-architecture by stephencelis 4 years ago
- Store can use @Published again (#239) * Store can use @Published again As of the third beta, assign(to:) takes an `inout Publisher.Publisher`, so it no longer surfaces an escape hatch through whi... — committed to pointfreeco/swift-composable-architecture by stephencelis 4 years ago
- Explicitly define `objectWillChange` on `ViewStore`. Because the `ViewStore` no longer uses `@Published` variables, the conformance to `ObservableObject` no longer sythesizes the `objectWillChange` p... — committed to nsillik/swift-composable-architecture by nsillik 3 years ago
- Explicitly define `objectWillChange` on `ViewStore`. (#353) * Explicitly define `objectWillChange` on `ViewStore`. Because the `ViewStore` no longer uses `@Published` variables, the conformance t... — committed to pointfreeco/swift-composable-architecture by nsillik 3 years ago
I figured out my problem. Be sure your state structs implement the Equatable protocol correctly. I had hard coded a return value of true and I suspect when you change state there is a comparison done to determine if a view update is warranted.