News for hackers. Stuff that matters.
Re:Advice on JSX Conditionals by favorited on Wednesday March 09, 2022 @04:03PM (#30619915)
> swift UI both had to add language features just to support if and loop expressions

The special syntax for loops in SwiftUI is important, because plain-old loops are always eager. For example, if you were building building a list using a loop, it would iterate over every item up-front to generate the list's body. With the `ForEach` struct, on the other hand, you provide the block to create each item, and it can be invoked lazily as the content will appear.

There are no comments on this comment yet.