🐦

SwiftUI performance tips

Video summary
  • Reduce dependencies
    • let _ = Self._printChanges() to debug
  • Faster view updates
    • Use async
    • String interpolations can be expensive, cache if necessary
    • Bundle lookup
    • Heap allocation
  • List
    • AnyView or if inside ForEach is expensive because the List needs to build all the views to retrieve the row identifiers because it doesn’t know how many views each element resolves to
    • Avoid nested ForEach except for sections
    • id should be inexpensive
    •