|
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:
|
|
|
|
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. |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
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.