-
The type of the target. Specify this via the generic argument on
ClassHook
.This type must be either the target’s own class or a class in its inheritance chain.
Declaration
Swift
associatedtype Target : AnyObject
-
If this is not
.none
, it indicates that this hook creates a subclass.The created subclass can be accessed via the static
target
property. The default value is.none
.This property is implemented by creating a new class pair on top of the original target, when the property is not
.none
.Declaration
Swift
static var subclassMode: SubclassMode { get }
-
An array of protocols which should be added to the target class.
The default value is an empty array.
Declaration
Swift
static var protocols: [Protocol] { get }
-
The current instance of the hooked class, upon which a hooked method has been called.
Declaration
Swift
var target: Target { get }
-
Initializes the type with the provided target instance. Do not invoke or override this.
Declaration
Swift
init(target: Target)
-
A function which is run before a
target
is deallocated.Use this to perform any cleanup before the target is deallocated.
The default implementation is equivalent to simply returning
DeinitPolicy.callOrig
.Important
You must not call
orig.deinitializer()
orsupr.deinitializer()
in this method. Instead, return the appropriate deinit policy.Declaration
Swift
func deinitializer() -> DeinitPolicy
Return Value
A
DeinitPolicy
representing the action to perform next. -
target
Extension methodThe concrete type of the hooked target (or its subclass depending on
subclassMode
).Declaration
Swift
public static var target: Target.Type { get }
-
orig
Extension methodA proxy to access the original instance methods of the hooked class.
Declaration
Swift
public var orig: Self { get }
-
orig
Extension methodA proxy to access the original class methods of the hooked class.
Declaration
Swift
public static var orig: Self.Type { get }
-
supr
Extension methodA proxy to access the hooked class’ superclass instance methods.
Declaration
Swift
public var supr: Self { get }
-
supr
Extension methodA proxy to access the hooked class’ superclass class methods.
Declaration
Swift
public static var supr: Self.Type { get }