LazyVStack in a ScrollView stuttering: causes and fixes in SwiftUI
Codemia Knowledge Hub ·
A LazyVStack or LazyHStack inside a ScrollView stutters because SwiftUI creates cells on demand as you scroll, and when that creation is expensive (complex layouts, image loading, state initialization) frames drop. Simplify the cell views, load and cache images asynchronously, keep heavy work out of onAppear, and give cells a fixed size so SwiftUI has less measuring to do. For large datasets, List often performs better than ScrollView plus LazyVStack because it recycles cells.
Why scrolling drops frames
What happens in a stuttering frame:
- The user scrolls down.
- SwiftUI determines new cells are needed.
LazyVStackcreates the cell's view body (layout, modifiers and so on).- SwiftUI measures the cell (calls
sizeThatFits). - SwiftUI renders the cell.
If steps 3 to 5 take longer than about 16ms (60 FPS) or about 8ms (120 FPS on ProMotion), the frame drops and scrolling stutters.
Fix 1: Simplify cell views
Reduce the work in each cell:
Each modifier (.shadow(), .clipShape(), .background(), .overlay()) adds a layer to the view hierarchy, and dozens per cell multiply the rendering cost. Consolidate modifiers and avoid expensive effects such as .blur() or .shadow() in scrolling cells.
Fix 2: Use fixed-size cells
When every cell has the same height, SwiftUI can skip measurement:
With dynamic heights, LazyVStack must measure each cell by calling its body, and that cost adds up during fast scrolling. Use .frame(height:) for fixed-height cells or pre-calculate heights where possible.
Fix 3: Cache images
AsyncImage starts a new download every time a cell appears and does not cache images between appearances. Use a cached loader instead, either a library such as Kingfisher or SDWebImage, or a custom NSCache-backed loader:
Fix 4: Use List instead of ScrollView + LazyVStack
List is backed by UIKit with cell recycling (UITableView, and UICollectionView since iOS 16), which is often smoother:
Fix 5: Prefetch data
Load the next page before the user reaches the end:
Keep onAppear closures light. They run on the main thread when the cell is created, so network requests, database queries or heavy computation there cause frame drops. Move that work into .task {} (async) or dispatch it to a background queue.
Fix 6: Avoid state initialization in cells
Also give ForEach stable identities. Without a stable id, SwiftUI may recreate views unnecessarily while scrolling. Use \.self only for simple value types; for model objects, conform to Identifiable with a stable id property so SwiftUI can reuse existing views.
Profiling the scroll with Instruments
Use Instruments (Time Profiler) to find which cells or modifiers cause the drops:
Related reading
- Putting a simple if-then-else statement on one line
- PyPy -- How can it possibly beat CPython?
- Pyramids dynamic programming
- Python - How can I make this code asynchronous?
- R cannot be resolved - Android error
- R cannot be resolved to a variable?
- Python - Is a dictionary slow to find frequency of each character?
- Python - Speed up an A Star Pathfinding Algorithm

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.