Hello the community, how are you?
Since few days, this messages displays as an error into my code: "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" Since all these days, I'm not able to solve this problem. My app is almost done and the code is good. But I don't find where the problem is from.
Here's the block where the message appears:
var body: some View { //The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
VStack {
TextField("Search invoices...", text: $searchText)
.padding(10)
.background(Color.gray.opacity(0.1))
.cornerRadius(10)
.padding(.horizontal)
HStack {
ForEach(BillFilter.allCases) { filter in
Button(action: {
selectedFilter = filter
}) {
Text(filter.rawValue)
.padding()
.background(selectedFilter == filter ? Color.accentColor : Color.gray.opacity(0.2))
.foregroundColor(selectedFilter == filter ? .white : .black)
.cornerRadius(8)
}
}
All the best,