@@ -35,7 +35,9 @@ public enum Interpose {
3535 ///
3636 /// - Throws: An ``InterposeError`` if the hook could not be prepared.
3737 ///
38- /// ### Example
38+ /// ### Examples
39+ ///
40+ /// #### Instance Method
3941 ///
4042 /// ```swift
4143 /// let hook = try Interpose.prepareHook(
@@ -55,6 +57,28 @@ public enum Interpose {
5557 /// try hook.apply()
5658 /// try hook.revert()
5759 /// ```
60+ ///
61+ /// #### Class Method
62+ ///
63+ /// ```swift
64+ /// let hook = try Interpose.prepareHook(
65+ /// on: MyClass.self,
66+ /// for: #selector(MyClass.getStaticValue),
67+ /// methodKind: .class,
68+ /// methodSignature: (@convention(c) (MyClass.Type, Selector) -> Int).self,
69+ /// hookSignature: (@convention(block) (MyClass.Type) -> Int).self
70+ /// ) { hook in
71+ /// return { `class` in
72+ /// print("Before")
73+ /// let value = hook.original(`class`, hook.selector)
74+ /// print("After")
75+ /// return value + 1
76+ /// }
77+ /// }
78+ ///
79+ /// try hook.apply()
80+ /// try hook.revert()
81+ /// ```
5882 public static func prepareHook< MethodSignature, HookSignature> (
5983 on `class`: AnyClass ,
6084 for selector: Selector ,
@@ -93,8 +117,10 @@ public enum Interpose {
93117 ///
94118 /// - Throws: An ``InterposeError`` if the hook could not be applied.
95119 ///
96- /// ### Example
97- ///
120+ /// ### Examples
121+ ///
122+ /// #### Instance Method
123+ ///
98124 /// ```swift
99125 /// let hook = try Interpose.applyHook(
100126 /// on: MyClass.self,
@@ -112,6 +138,27 @@ public enum Interpose {
112138 ///
113139 /// try hook.revert()
114140 /// ```
141+ ///
142+ /// #### Class Method
143+ ///
144+ /// ```swift
145+ /// let hook = try Interpose.applyHook(
146+ /// on: MyClass.self,
147+ /// for: #selector(MyClass.getStaticValue),
148+ /// methodKind: .class,
149+ /// methodSignature: (@convention(c) (MyClass.Type, Selector) -> Int).self,
150+ /// hookSignature: (@convention(block) (MyClass.Type) -> Int).self
151+ /// ) { hook in
152+ /// return { `class` in
153+ /// print("Before")
154+ /// let value = hook.original(`class`, hook.selector)
155+ /// print("After")
156+ /// return value + 1
157+ /// }
158+ /// }
159+ ///
160+ /// try hook.revert()
161+ /// ```
115162 @discardableResult
116163 public static func applyHook< MethodSignature, HookSignature> (
117164 on `class`: AnyClass ,
0 commit comments