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 ruleP0universalStack: mobile
mobilesecuritykeychainstorage
Store credentials in Keychain/Keystore, not UserDefaults/SharedPreferences
UserDefaults/SharedPreferences are plaintext and backed up; put tokens and passwords in the platform secure store.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | UserDefaults.standard.set(token, forKey: "authToken") |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | Keychain.set(token, for: .authToken) |
Explanation (EN)
Objašnjenje (HR)