From c3f1cf8c13b7afd0bcba5915b450f501b6193cbc Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Wed, 25 Mar 2026 23:45:43 -0700 Subject: [PATCH] Create a view with 600 copies of the same SVG (stress test) --- Sources/Showcase/ImagePlayground.swift | 26 +++++++++++++++++++ .../Showcase/Resources/Localizable.xcstrings | 6 +++++ 2 files changed, 32 insertions(+) diff --git a/Sources/Showcase/ImagePlayground.swift b/Sources/Showcase/ImagePlayground.swift index ddbbad9..3a59b4d 100644 --- a/Sources/Showcase/ImagePlayground.swift +++ b/Sources/Showcase/ImagePlayground.swift @@ -23,6 +23,9 @@ struct ImagePlayground: View { NavigationLink("Complex Layout (Portrait)") { ImagePlaygroundComplexLayoutView(imageName: "CatPortrait") } + NavigationLink("Butterfly LazyHGrid Stress") { + ImagePlaygroundButterflyGridStressView() + } Text("Asset JPEG Image").font(.title).bold() HStack { @@ -388,3 +391,26 @@ private struct ImagePlaygroundComplexLayoutView: View { } } } + +private struct ImagePlaygroundButterflyGridStressView: View { + private let butterflies = Array(0..<600) + private let rows: [GridItem] = Array(repeating: GridItem(.fixed(24), spacing: 4), count: 10) + + var body: some View { + ScrollView(.horizontal) { + LazyHGrid(rows: rows, spacing: 4) { + ForEach(butterflies, id: \.self) { _ in + Image("Butterfly", bundle: .module, label: Text("Butterfly SVG image")) + .resizable() + .scaledToFit() + .frame(width: 24, height: 24) + } + } + .padding(8) + } + .navigationTitle("Butterfly Grid Stress") + .toolbar { + PlaygroundSourceLink(file: "ImagePlayground.swift") + } + } +} diff --git a/Sources/Showcase/Resources/Localizable.xcstrings b/Sources/Showcase/Resources/Localizable.xcstrings index 8b82b12..bedb6a3 100644 --- a/Sources/Showcase/Resources/Localizable.xcstrings +++ b/Sources/Showcase/Resources/Localizable.xcstrings @@ -986,6 +986,12 @@ }, "Bundled Image" : { + }, + "Butterfly Grid Stress" : { + + }, + "Butterfly LazyHGrid Stress" : { + }, "Butterfly SVG image" : {