-
A method hook.
replacementrepresents an Objective-C methodIMP. It should be a@convention(c)function which takesself: AnyObjectand_cmd: Selectoras its first two arguments. The remaining argument types should be the argument types of the hooked Objective-C method in order, and the return type should be the return type of the method.If a class method is being hooked,
clsshould be the metaclass.completionis a closure which will be passed the original method implementation when the hook is applied, or an error on failure. It may be called more than once during the duration ofBackend.apply(descriptors:).Declaration
Swift
case method(cls: AnyClass, sel: Selector, replacement: UnsafeMutableRawPointer, completion: Completion) -
A function hook.
replacementshould be a@convention(c)function with the same signature as the function which is to be hooked.completionis a closure which will be passed the original method implementation when the hook is applied, or an error on failure. It may be called more than once during the duration ofBackend.apply(descriptors:).Declaration
Swift
case function(function: Function, replacement: UnsafeMutableRawPointer, completion: Completion)
View on GitHub
Install in Dash
HookDescriptor Enumeration Reference