AssertUtilities
public enum AssertUtilities
A utility type that replaces the internal implementation of assertion functions.
-
A closure that handles an assertion.
Declaration
Swift
public typealias AssertClosure = (Bool, Error, StaticString, UInt) -> ()
-
A closure that handles an assertion failure.
Declaration
Swift
public typealias AssertionFailureClosure = (Error, StaticString, UInt) -> ()
-
Replaces the internal implementation of
assert(_:error:file:line:)
with the given closure. Returns aRestorationHandler
to execute that restores the original implentation.Declaration
Swift
static public func replaceAssert( with closure: @escaping AssertClosure ) -> RestorationHandler
Parameters
closure
The closure to execute when
assert(_:error:file:line:)
is called. -
Replaces the internal implementation of
assertionFailure(error:file:line:)
with the given closure. Returns aRestorationHandler
to execute that restores the original implentation.Declaration
Swift
static public func replaceAssertionFailure( with closure: @escaping AssertionFailureClosure ) -> RestorationHandler
Parameters
closure
The closure to execute when
assertionFailure(error:file:line:)
is called.