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
ioslifecyclecallbacksbug
Execute completion callbacks before dismissing/deallocating a view
If you dismiss (or pop) a view before its selected-action callback runs, deallocation can cancel the remaining code; run the callback first or from the dismiss completion.
PR: mobile-mining-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | dismiss(animated: true); onSelect(item) // may not run |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | onSelect(item); dismiss(animated: true) // or call in dismiss completion |
Explanation (EN)
Objašnjenje (HR)