A number of if statements inside ViewBuilder fails constructing

0
60


I get the error "The compiler is unable to type-check this expression in affordable time; strive breaking apart the expression into distinct sub-expressions" when making an attempt the next code.

I came upon that breaking apart the syntaxes into smaller bits would assist however its nonetheless not working. I additionally tried specifying the info sorts nonetheless the error persists.

This code works if there is just one "if assertion"

ScrollView{
            ForEach(discoverManager.discoverResponse, id: .id) { discoverSection in
              LazyVStack(alignment: .main){
                Textual content(discoverSection.title ?? "").fontWeight(.daring)
                ScrollView(.horizontal) {
                  
                  if let collectionName: String = discoverSection.collectionName, collectionName == "customers", let customers: [ProfileDatas] = discoverSection.customers {
                    HStack{
                      ForEach(customers, id: .self){ person in
                        let picture: String = person.userProfile?.avatar ?? "default.jpg"
                        let identify: String = person.userProfile?.firstName ?? person.username ?? ""
                        let position: String = person.defaultRole ?? ""
                        let uploadedTime: String = person.createdAt ?? ""
                        DiscoverLargeSlide(imageUrl: picture.createImageURL(), title: identify, uploader: position, uploadedTime: uploadedTime)
                          .body(width: metrics.dimension.width * 0.8, top: metrics.dimension.top * 0.2)
                      }
                    }
                  }
                  
                  if let collectionName: String = discoverSection.collectionName, collectionName == "style", let genres: [SubgenreItem] = discoverSection.style {
                    HStack{
                      ForEach(genres, id: .self){ style in
                        let picture: String = style.picture ?? "default.jpg"
                        let title: String = style.subGenre ?? ""
                        DiscoverSqaureSlide(imageUrl: picture.createImageURL(), title: title)
                          .body(width: metrics.dimension.width * 0.8, top: metrics.dimension.top * 0.2)
                      }
                    }
                  }
                  
                  
                }
              }
              .padding(.main, 12.0)
            }
            
            Textual content("Hiya")
}