Unabled compiler

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,

Thanks for the post. Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

So people wanting to help don't have to just copy and paste your code and create all the variables you didn't provide list searchText.

Albert Pascual
  Worldwide Developer Relations.

Unabled compiler
 
 
Q