Skip to content

Commit 910ebb0

Browse files
committed
Improved docs for methodSignature and hookSignature parameters
1 parent 63890e7 commit 910ebb0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

Sources/InterposeKit/Interpose.swift

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ public enum Interpose {
2323
/// - class: The class on which the method is defined.
2424
/// - selector: The selector of the method to hook.
2525
/// - methodKind: Whether the method is an instance or class method. Defaults to `.instance`.
26-
/// - methodSignature: The expected C function type of the original method implementation.
27-
/// - hookSignature: The type of the hook block.
26+
/// - methodSignature: The expected type of the original Objective-C method, declared using
27+
/// `@convention(c)`. The function must take the receiving object and selector as its first
28+
/// two parameters, e.g. `(@convention(c) (Receiver, Selector, Parameter) -> ReturnValue).self`.
29+
/// - hookSignature: The expected type of the hook block, declared using `@convention(block)`.
30+
/// It must match the method signature, excluding the `Selector` parameter, e.g.
31+
/// `(@convention(block) (Receiver, Parameter) -> ReturnValue).self`.
2832
/// - build: A closure that receives a proxy to the hook and returns the hook block.
2933
///
3034
/// - Returns: The prepared hook instance in the pending state.
@@ -77,8 +81,12 @@ public enum Interpose {
7781
/// - class: The class on which the method is defined.
7882
/// - selector: The selector of the method to hook.
7983
/// - methodKind: Whether the method is an instance or class method. Defaults to `.instance`.
80-
/// - methodSignature: The expected C function type of the original method implementation.
81-
/// - hookSignature: The type of the hook block.
84+
/// - methodSignature: The expected type of the original Objective-C method, declared using
85+
/// `@convention(c)`. The function must take the receiving object and selector as its first
86+
/// two parameters, e.g. `(@convention(c) (Receiver, Selector, Parameter) -> ReturnValue).self`.
87+
/// - hookSignature: The expected type of the hook block, declared using `@convention(block)`.
88+
/// It must match the method signature, excluding the `Selector` parameter, e.g.
89+
/// `(@convention(block) (Receiver, Parameter) -> ReturnValue).self`.
8290
/// - build: A closure that receives a proxy to the hook and returns the hook block.
8391
///
8492
/// - Returns: The applied hook instance in the active state.
@@ -144,8 +152,12 @@ public enum Interpose {
144152
/// - Parameters:
145153
/// - object: The object on which to hook the method.
146154
/// - selector: The selector of the method to hook.
147-
/// - methodSignature: The expected C function type of the original method implementation.
148-
/// - hookSignature: The type of the hook block.
155+
/// - methodSignature: The expected type of the original Objective-C method, declared using
156+
/// `@convention(c)`. The function must take the receiving object and selector as its first
157+
/// two parameters, e.g. `(@convention(c) (Receiver, Selector, Parameter) -> ReturnValue).self`.
158+
/// - hookSignature: The expected type of the hook block, declared using `@convention(block)`.
159+
/// It must match the method signature, excluding the `Selector` parameter, e.g.
160+
/// `(@convention(block) (Receiver, Parameter) -> ReturnValue).self`.
149161
/// - build: A closure that receives a proxy to the hook and returns the hook block.
150162
///
151163
/// - Returns: The prepared hook instance in the pending state.
@@ -201,8 +213,12 @@ public enum Interpose {
201213
/// - Parameters:
202214
/// - object: The object on which to hook the method.
203215
/// - selector: The selector of the method to hook.
204-
/// - methodSignature: The expected C function type of the original method implementation.
205-
/// - hookSignature: The type of the hook block.
216+
/// - methodSignature: The expected type of the original Objective-C method, declared using
217+
/// `@convention(c)`. The function must take the receiving object and selector as its first
218+
/// two parameters, e.g. `(@convention(c) (Receiver, Selector, Parameter) -> ReturnValue).self`.
219+
/// - hookSignature: The expected type of the hook block, declared using `@convention(block)`.
220+
/// It must match the method signature, excluding the `Selector` parameter, e.g.
221+
/// `(@convention(block) (Receiver, Parameter) -> ReturnValue).self`.
206222
/// - build: A closure that receives a proxy to the hook and returns the hook block.
207223
///
208224
/// - Returns: The applied hook instance in the active state.

0 commit comments

Comments
 (0)