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
mobiletestingarchitecture
Unit-test business logic in view models/use-cases
Put logic in testable, UI-free types (view models, use cases) and unit-test them; don't hide logic in view controllers/activities.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | // formatting + rules buried in the UIViewController, untestable |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | // ViewModel.format() covered by XCTest / JUnit |
Explanation (EN)
Objašnjenje (HR)