You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README-legacy.md
-30Lines changed: 0 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,36 +58,6 @@ InterposeKit can hook classes and object. Class hooking is similar to swizzling,
58
58
59
59
Caveat: Hooking will fail with an error if the object uses KVO. The KVO machinery is fragile and it's to easy to cause a crash. Using KVO after a hook was created is supported and will not cause issues.
60
60
61
-
## Various ways to define the signature
62
-
63
-
Next to using `methodSignature` and `hookSignature`, following variants to define the signature are also possible:
64
-
65
-
### methodSignature + casted block
66
-
```
67
-
let interposer = try Interpose(testObj) {
68
-
try $0.hook(
69
-
#selector(TestClass.sayHi),
70
-
methodSignature: (@convention(c) (AnyObject, Selector) -> String).self) { store in { `self` in
71
-
let string = store.original(`self`, store.selector)
72
-
return string + testString
73
-
} as @convention(block) (AnyObject) -> String }
74
-
}
75
-
```
76
-
77
-
### Define type via store object
78
-
```
79
-
// Functions need to be `@objc dynamic` to be hookable.
Copy file name to clipboardExpand all lines: README.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,36 @@ This is a continuation and modernization of [Peter Steinberger’s original impl
26
26
- arm64 and x86_64 architectures
27
27
- Examples: instance method on class, class method on class, object
28
28
29
-
## Changes from [Original Implementation](https://github.com/steipete/InterposeKit)
29
+
## What’s Changed
30
30
31
-
- ...
31
+
Compared to the [original implementation](https://github.com/steipete/InterposeKit), this fork introduces several API and internal changes. Here is a summary of key differences with migration hints.
32
+
33
+
### Environment
34
+
35
+
- Switched the library to Swift Package Manager only. Carthage and CocoaPods support was removed.
36
+
- Raised minimum Swift version to 5.9.
37
+
- Limited to Apple platforms with arm64 and x86_64 architectures. Support for Linux was removed.
38
+
39
+
### API Changes
40
+
41
+
- Class hooks now support class methods.
42
+
- Removed the builder-based API `Interpose(…) { … }` for applying hooks in batches. Each hook must now be individually prepared, applied, and reverted.
43
+
- Signature types must now be specified via parameters, improving clarity and streamlining the API.
44
+
- Renamed `hook(…)` methods to `applyHook(…)`.
45
+
- Removed fluent-style `Hook` API, meaning that methods no longer return `self`.
46
+
- Introduced `HookProxy`, which is passed into the hook builder. It still provides access to the original method implementation and selector, but hides irrelevant APIs like `revert()`.
47
+
- Hook types now use composition instead of inheritance. The public `Hook` class delegates to internal strategies conforming to `HookStrategy`.
48
+
- Object hooks now use a global counter instead of UUIDs for dynamic subclass names.
49
+
- Dynamic subclasses created at runtime are now cleaned up when the last hook is reverted on an object.
50
+
- Class hooks must now target the exact class that actually implements the method to ensure the revert functionality works correctly.
51
+
- Added initial Swift 6 compatibility with some thread-safety checks. Most usage is still expected to be single-threaded, though.
52
+
- Removed support for [delayed hooking](https://steipete.com/posts/mac-catalyst-crash-hunt/) (`whenAvailable(…)`) to keep the library laser-focused.
53
+
- …and heavily refactored the Swift part of the codebase: cleaner use of Objective-C runtime APIs, a revamped `InterposeError` enum, and new supporting types like `HookScope` or `HookState`.
54
+
55
+
### Fixes
56
+
57
+
- Fixed a crash where `IKTAddSuperImplementationToClass` was stripped in release builds per [steipete/InterposeKit#29](https://github.com/steipete/InterposeKit#29) by using the fix from [steipete/InterposeKit#30](https://github.com/steipete/InterposeKit#30) submitted by @Thomvis, which replaces a call via dynamic library with a direct Swift call to `IKTSuperBuilder.addSuperInstanceMethod(to:selector:)`.
58
+
- Fixed floating-point register handling on arm64 using the patch from [steipete/InterposeKit#37](https://github.com/steipete/InterposeKit#37) submitted by @ishutinvv, which resolves an issue affecting swizzled methods with `CGFloat` parameters or structs like `CGPoint` and `CGRect` due to floating-point registers not being restored in the correct order after the trampoline call.
0 commit comments