Skip to content
Discussion options

You must be logged in to vote

Hi @dirtyhenry, I was able to reproduce this in iOS 16, though it does seem fixed in iOS 17 somehow.

I can't explain it, but something about Data and WithViewStore makes SwiftUI get into a very weird state. You can avoid WithViewState by using @ObservedObject directly:

struct RootView: View {
  let store: StoreOf<RootFeature>
  @ObservedObject var viewStore: ViewStoreOf<RootFeature>
  init(store: StoreOf<RootFeature>) {
    self.store = store
    self.viewStore = ViewStore(self.store, observe: { $0 })
  }}

That fixes the problem somehow.

Additionally I would say that generally it is not necessary to store Data in state. What is the reason to store the data in state? Is it needed to …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dirtyhenry
Comment options

@dirtyhenry
Comment options

@mbrandonw
Comment options

Answer selected by dirtyhenry
@dirtyhenry
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants