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 aRestorationHandlerto execute that restores the original implentation.Declaration
Swift
static public func replacePrecondition( with closure: @escaping PreconditionClosure ) -> RestorationHandlerParameters
closureThe closure to execute when
precondition(_:error:file:line:)is called. -
Replaces the internal implementation of
preconditionFailure(error:file:line:)with the given closure. Returns aRestorationHandlerto execute that restores the original implentation.Declaration
Swift
static public func replacePreconditionFailure( with closure: @escaping PreconditionFailureClosure ) -> RestorationHandlerParameters
closureThe closure to execute when
preconditionFailure(error:file:line:)is called.
View on GitHub
PreconditionUtilities Enumeration Reference