assertionFailure(_:file:line:)
Indicates that an internal consistency check failed.
Declaration
func assertionFailure(_ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line)Parameters
- message:
A string to print in a playground or
-Ononebuild. The default is an empty string. - file:
The file name to print with
message. The default is the file whereassertionFailure(_:file:line:)is called. - line:
The line number to print along with
message. The default is the line number whereassertionFailure(_:file:line:)is called.
Discussion
This function’s effect varies depending on the build flag used:
In playgrounds and
-Ononebuilds (the default for Xcode’s Debug configuration), stop program execution in a debuggable state after printingmessage.In
-Obuilds, has no effect.In
-Ouncheckedbuilds, the optimizer may assume that this function is never called. Failure to satisfy that assumption is a serious programming error.