Skip to content

Conversation

@flocked
Copy link
Contributor

@flocked flocked commented May 10, 2025

Added support to reapply a hook cancelled hook using it's token.

  • Removed Token and OCToken.
  • class HookToken: NSObject is now returned for all hooking methods (HookToken.swift). It has the following public methods:
    • revert() (instead of cancelHook()) to revert a hook.
    • apply() to reapply a reverted hook.
    • isActive: A Boolean value indicating if a hook is active.
  • moved parametersCheck to the init method of the HookToken.

@623637646
Copy link
Owner

Hi @flocked . Thanks for your PR. This idea is very novel.
But I don't think there is a strong scenario to re-hook by tokens. If users want to hook again, Just do it normally.
And other libraries similar with SwiftHook also don't have this feature. like:
https://github.com/eleme/Stinger
https://github.com/steipete/InterposeKit
https://github.com/steipete/Aspects

@flocked
Copy link
Contributor Author

flocked commented May 11, 2025

InterposeKit does implement this using AnyHook's func apply() throws

@623637646
Copy link
Owner

I see. Thanks for the clarification. This feature is very large. and it needs full Tests if we do so. At this point I still don't think it's worth it. Let's keep this Pull Request. We can pick it up if needed in the future.
Thanks again for your contribution! @flocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants