|
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 AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.