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 ruleP2stack specificStack: swift
swiftconcurrencyasync-awaitreadability
Prefer async/await over nested completion handlers
Deeply nested callbacks are hard to read and easy to get wrong on error paths; use async/await for sequential async work.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | a { r1 in b(r1) { r2 in c(r2) { done($0) } } } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | let r1 = await a(); let r2 = await b(r1); done(await c(r2)) |
Explanation (EN)
Objašnjenje (HR)