Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
mobile ruleP1universalStack: mobile
mobileperformanceimagesmemory
Downsample large images to the display size
Loading full-resolution images into small views wastes memory and can OOM; downsample/resize to the target size (or use an image lib).
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | imageView.image = UIImage(data: hugeData) |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | imageView.image = downsample(hugeData, to: imageView.bounds.size) |
Explanation (EN)
Objašnjenje (HR)