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 ruleP0stack specificStack: ios
iosthreadinguimain-thread
Perform all UI updates on the main thread
UIKit/SwiftUI are not thread-safe; hop back to the main thread (DispatchQueue.main / @MainActor) before touching UI.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codeswift
| 1 | URLSession.shared.dataTask(with: url) { d,_,_ in self.label.text = parse(d) } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeswift
| 1 | DispatchQueue.main.async { self.label.text = text } |
Explanation (EN)
Objašnjenje (HR)