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 ruleP0stack specificStack: ios
iosthreadingperformancemain-thread
Never do blocking I/O or heavy work on the main thread
Synchronous network/disk/CPU work on the main thread freezes the UI; move it to a background queue or async/await.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | let data = try! Data(contentsOf: remoteURL) // on main |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | let data = try await URLSession.shared.data(from: remoteURL).0 |
Explanation (EN)
Objašnjenje (HR)