Skip to content

Compiler giving "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" issue when using multiple sheets with Destination Reducer approach #2922

Discussion options

You must be logged in to vote

Hi @parvBhaskarStryker, there is no limitation set by TCA, but there may be limitations of the Swift compiler. Typically you can move the sheet's to their own helper in the view to help out the compiler:

extension View {
  func destinations(store: Binding<StoreOf<Feature>>) -> some View {
    self
      .sheet(item: store.scope()) {  }
      .sheet(item: store.scope()) {  }
      .sheet(item: store.scope()) {  }
      .sheet(item: store.scope()) {  }
  }
}

And the do:

var body: some View {
  Form {
  }
  .destinations(store: $store)
}

That's the rough idea.

In the future these kinds of compilation problems will hopefully get better when we can delete the many overloads we have in …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@tobitech
Comment options

@mbrandonw
Comment options

@tobitech
Comment options

@mbrandonw
Comment options

@tobitech
Comment options

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