dispatchPrecondition(condition:)
Checks a dispatch condition necessary for further execution.
Declaration
func dispatchPrecondition(condition: @autoclosure () -> DispatchPredicate)Parameters
- condition:
A dispatch predicate for the current context to check.
Discussion
Use this function to detect conditions about the current execution context that must prevent the program from proceeding even in shipping code.
In playgrounds and
-Ononebuilds (the default for Xcode’s Debug configuration): ifconditionevaluates tofalse, stop program execution in a debuggable state.In
-Obuilds (the default for Xcode’s Release configuration): ifconditionevaluates tofalse, stop program execution.In
-Ouncheckedbuilds,conditionis not evaluated, but the optimizer may assume that it would evaluate totrue. Failure to satisfy that assumption in-Ouncheckedbuilds is a serious programming error.