|
I was working through Project 15 and when I was doing the challenges of adding accessibility to old projects I kept getting an error if I passed anything other than a string literal to accessibilityLabel. The error is "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions." So if I had:
It worked fine. But if I had:
I'd get an error. This is from iExpense and item is an ExpenseItem and the name property is a string. |
|
Here's ContentView:
Here's the ExpenseItem struct:
|
|
I also tried cleaning the build folder, closing/reopening the project, closing/reopening xcode and rebooting. |
|
Try to refactor the EG
then in
|
|
Since And a separate note: You should really filter your expenses before you loop through them rather than having an |
|
@roosterboy Re: filtering, I remember I tried that but there was a problem that made it difficult to implement. I asked here about it and the best solution anyone had was using the if statements. I can't say it's elegant, I was inclined to try something like we have in C#/.NET, items.where(x => x.type == "Business"), but I couldn't find a syntactical equivalent. |
SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.