Write, review, or improve UIKit code following best practices for view controller lifecycle, Auto Layout, collection views, navigation, animation, memory management, and modern iOS 18–26 APIs. Use when building new UIKit features, refactoring existing views or view controllers, reviewing code quality, adopting modern UIKit patterns (diffable data sources, compositional layout, cell configuration), or bridging UIKit with SwiftUI. Does not cover SwiftUI-only code.
96
100%
Does it follow best practices?
Impact
96%
1.23xAverage score across 9 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent implements efficient async image loading in a UICollectionView using ImageIO downsampling (or byPreparingThumbnail), correct cell-reuse Task cancellation, NSCache costed by decoded bytes, UICollectionView.CellRegistration stored as a property, and UICollectionViewDiffableDataSource with stable UUIDs.",
"type": "weighted_checklist",
"checklist": [
{
"name": "ImageIO downsampling",
"description": "Uses CGImageSourceCreateThumbnailAtIndex (from ImageIO framework) OR byPreparingThumbnail(ofSize:) — does NOT use UIImage(contentsOfFile:)/UIImage(named:) followed by a separate resize/draw step",
"max_score": 14
},
{
"name": "Display-size thumbnail",
"description": "The thumbnail is requested or created at the cell's display size (e.g. cell bounds or a fixed pixel dimension), not at the full original image resolution",
"max_score": 10
},
{
"name": "Task cancellation in prepareForReuse",
"description": "PhotoCell overrides prepareForReuse and cancels the image-loading Task (calls task.cancel() or similar) inside that override",
"max_score": 14
},
{
"name": "Image cleared in prepareForReuse",
"description": "prepareForReuse sets the image view's image to nil (or clears it) before cancellation",
"max_score": 8
},
{
"name": "Identity check before setting image",
"description": "After the async load completes, the code verifies the cell still corresponds to the same photo (e.g. checks a stored URL, ID, or tag) before assigning the image to the image view — preventing stale images in recycled cells",
"max_score": 12
},
{
"name": "NSCache cost = decoded bytes",
"description": "When inserting into NSCache, the cost argument is computed from pixel dimensions × 4 (e.g. width * height * 4 or cgImage.bytesPerRow * cgImage.height), NOT from data.count or file size",
"max_score": 10
},
{
"name": "CellRegistration stored property",
"description": "UICollectionView.CellRegistration is stored as a property (e.g. lazy var or let) on the view controller or data source — it is NOT created inside the cell provider closure",
"max_score": 10
},
{
"name": "DiffableDataSource with UUID identifiers",
"description": "Uses UICollectionViewDiffableDataSource keyed by UUID (or another stable scalar ID), not by the full model struct",
"max_score": 10
},
{
"name": "No string-based cell dequeue",
"description": "Does NOT use register(_:forCellWithReuseIdentifier:) or dequeueReusableCell(withReuseIdentifier:for:) — uses dequeueConfiguredReusableCell(using:for:item:) from CellRegistration instead",
"max_score": 12
}
]
}