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: ios
iosuikitview-setupconsistency
Give custom views/cells a consistent init + setup structure
Custom UIView/UITableViewCell subclasses should share one init pattern (commonInit → setupUI → setupConstraints) instead of ad-hoc per-cell setup.
PR: mobile-mining-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | // each cell wires subviews differently, some missing init |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | init(...) { super.init(...); commonInit() } |
| 2 | private func commonInit() { setupUI(); setupConstraints() } |
Explanation (EN)
Objašnjenje (HR)