My favorite line of my code in my app — which appears in multiple places — is precondition(Thread.isMainThread)
.
Because 1) main-thread-only code is easier to read, write, and maintain, and 2) any violations should be noticed by the developer immediately.