PreconditionUtilities
public enum PreconditionUtilities
A utility type that replaces the internal implementation of precondition functions.
-
A closure that handles a precondition.
Declaration
Swift
public typealias PreconditionClosure = (Bool, Error, StaticString, UInt) -> ()
-
A closure that handles a precondition failure.
Declaration
Swift
public typealias PreconditionFailureClosure = (Error, StaticString, UInt) -> Never
-
Replaces the internal implementation of
precondition(_:error:file:line:)
with the given closure. Returns aRestorationHandler
to execute that restores the original implentation.Declaration
Swift
static public func replacePrecondition( with closure: @escaping PreconditionClosure ) -> RestorationHandler
Parameters
closure
The closure to execute when
precondition(_:error:file:line:)
is called. -
Replaces the internal implementation of
preconditionFailure(error:file:line:)
with the given closure. Returns aRestorationHandler
to execute that restores the original implentation.Declaration
Swift
static public func replacePreconditionFailure( with closure: @escaping PreconditionFailureClosure ) -> RestorationHandler
Parameters
closure
The closure to execute when
preconditionFailure(error:file:line:)
is called.