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 ruleP1stack specificStack: ios
iosarchitecturemvvmseparation-of-concerns
Keep view controllers thin; extract logic out of the VC
Move networking, formatting and business logic out of UIViewController into view models/services so the VC only wires views.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | // 800-line UIViewController doing fetch + parse + format + layout |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | // VC binds to a ViewModel that owns fetch/format; VC just renders |
Explanation (EN)
Objašnjenje (HR)