SwiftUI perf tip
In lazy containers (List, LazyVStack), the view ForEach produces per element should be a *constant* number of views. An if inside the closure means 1 or 0 views, non-constant, and hits a slow path.
Wrap the condition in a VStack:
ForEach(namedFonts) { namedFont in
VStack {
if namedFont.name.count != 2 {
Text(https://namedFont.name)
}
}
}
or filter your data upfront.
Debug with: -LogForEachSlowPath YES
π https://developer.apple.com/documentation/swiftui/foreach
