From 554a4022c96951beb2708d3d7a37c2c5fefa7987 Mon Sep 17 00:00:00 2001 From: Vegard Bieker Matthey Date: Tue, 14 Jul 2026 00:10:36 +0200 Subject: [PATCH] perf: shortcircuit scrollingImageView --- ImageViewer/ViewController.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ImageViewer/ViewController.swift b/ImageViewer/ViewController.swift index c3aefa0..0c4ddf3 100644 --- a/ImageViewer/ViewController.swift +++ b/ImageViewer/ViewController.swift @@ -1421,6 +1421,7 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl withReuseIdentifier: "ScrollingImageCell", for: indexPath ) as! ScrollingImageCell + if mode != .scroll { return cell } if metadata == nil { print("metadata is nil, should probably not be the case") return cell @@ -1599,6 +1600,7 @@ class ImageLoader { } if let completion = completion { + assert(loadingTasks[key] == nil) loadingTasks[key] = completion } if let existing = activeTokens[key], !existing.isCancelled {