Show Details items of List in BottomSheet (Error : The compiler is unable to type-check this expression in reasonable time...) SwiftUI

Viewed 44

I have a list with multiselection, on Submit button I am showing BottomSheet displaying details of selected items. It is showing successfully. I have used ScrollView to show details using viewmodel.The id of selected items are sent in URL query. The detail view is simply showing list based on those ids. No issues.

However, now I am trying to show detail in card so that detail of selected items should show individually in a card instead of single list. Now if I use same method as above the items are repeating when I use the below:

ForEach(detailResponse.detailResponse){detail in
MyDetailRow(detailResponse:detail)}

If I use the above and no model but assigning values to items using data model struct in detail view than no data is displayed.

UPDATE

All things sorted out except this one :

ForEach(nam.testPackage.indices){
        test in Text("\(test+1). " + "\(nam.testPackage[test].testListName)")
.font(.system(size: 10))
.fontWeight(.semibold)

ForEach(nam.testPackage[test].metabolite.indices){met in

       Text("\(met+1). " + "\(nam.testPackage[test].metabolite[met].metaboliteName)")
   }
  }

The compiler keeps throwing "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions"

Strange thing is the same exression is working fine when I am using

ForEach(modelobject.response){data in .......

instead of

(response){data in .....

How to resolve this ? I have checked all other possible errors like typo etc by running the code break step by step ie executing one HStack or VStack one by one in struct

0 Answers
Related