swift-composable-architecture: xcode hangs when adding @ObservedObject to ViewStore
When I am adding
@ObservedObject var viewStore: ViewStore<State, Action>
my Xcode hangs and I have to force quit it.
is there anything I am missing ?.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (9 by maintainers)
@mathieutozer It’s definitely annoying, but almost always seems to be related to typos on the
viewStore
, right? Wish we could fix this but we’ll have to wait on Apple for this one. When you encounter the issue it doesn’t hurt to file a report at https://bugs.swift.orgOne thing to save you a reboot in the future is to open Activity Monitor, go to the Memory tab, and kill any “swift” and “SourceKit” processes that are spiking in memory.
One thing that comes to mind, though, is that there seems to be a bug around dynamic member lookup (which
ViewStore
uses) and complex view builders, such that if you have a typo on theviewStore
, it can hang builds indefinitely. You can usually zero in on the typo by either commenting out portions of the view that call toviewStore
, or by explicitly accessing state throughviewStore.state
.@stephencelis give me some time, I will check it send you to update. Thanks
@Shivam412 We still need a full example that we can try to compile to help. Can you zip up your project and post it here?
Can you post a full, compiling example? The culprit is likely in this
body
, but without a case that we can reproduce we’re not going to be able to help.