HookDescriptor

public enum HookDescriptor

A type describing a single hook.

  • The completion handler type. The closure is passed the original implementation.

    Declaration

    Swift

    public typealias Completion = (UnsafeMutableRawPointer) -> Void
  • A method hook.

    replacement represents an Objective-C method IMP. It should be a @convention(c) function which takes self: AnyObject and _cmd: Selector as 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.

    Declaration

    Swift

    case method(cls: AnyClass, sel: Selector, replacement: UnsafeMutableRawPointer, completion: Completion)
  • A function hook.

    replacement should be a @convention(c) function with the same signature as the function which is to be hooked.

    Declaration

    Swift

    case function(function: Function, replacement: UnsafeMutableRawPointer, completion: Completion)