All Projects → KyriosArk → KYHooker

KyriosArk / KYHooker

Licence: MIT license
A library for complex aspect oriented programming

Programming Languages

objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to KYHooker

aspectgo
Aspect-Oriented Programming framework for Go
Stars: ✭ 62 (+63.16%)
Mutual labels:  hook, aspect-oriented-programming
AspecTS
An aspect-oriented programming library implemented in TypeScript
Stars: ✭ 21 (-44.74%)
Mutual labels:  aspect-oriented-programming, aspects
Aspect4Delphi
Concepts of aspect-oriented programming (AOP) in Delphi.
Stars: ✭ 28 (-26.32%)
Mutual labels:  aspect-oriented-programming, aspects
use-prefers-color-scheme
🪝 React hook for subscribing to user's color scheme preference.
Stars: ✭ 28 (-26.32%)
Mutual labels:  hook
react-use-hoverintent
React hook for hoverIntent
Stars: ✭ 16 (-57.89%)
Mutual labels:  hook
use-react-router-breadcrumbs
tiny, flexible, hook for rendering route breadcrumbs with react-router v6
Stars: ✭ 170 (+347.37%)
Mutual labels:  hook
entangle
Global state management tool for react hooks inspired by RecoilJS and Jotai using proxies.
Stars: ✭ 26 (-31.58%)
Mutual labels:  hook
react-health-check
Lightweight React hook for checking health of API services.
Stars: ✭ 28 (-26.32%)
Mutual labels:  hook
UnityExternal
Unity project demonstrating the use of an external C# project with Visual Studio Tools for Unity (VSTU).
Stars: ✭ 24 (-36.84%)
Mutual labels:  hook
WechatHttpApiWeb
Wechat Http Api Html
Stars: ✭ 36 (-5.26%)
Mutual labels:  hook
OSRSUpdater
A simple (and outdated) Old-School RuneScape decompiler/deobfuscator. Performs field and method analysis which uses ASM and bytecode patterns for identification. Identified fields could be used for creating bot clients or QoL clients. For educational use only.
Stars: ✭ 13 (-65.79%)
Mutual labels:  hook
CNeptune
CNeptune improve productivity & efficiency by urbanize .net module with meta-code to lay foundation for frameworks
Stars: ✭ 30 (-21.05%)
Mutual labels:  aspect-oriented-programming
fine
🧹 Gracefully shutdown Node.js application: help you handle exit signals and cleanup
Stars: ✭ 20 (-47.37%)
Mutual labels:  hook
react-use-observer
Performant react hooks for WebApi Observers, useResizeObserver, useInteractionObserver, useMutationObserver
Stars: ✭ 19 (-50%)
Mutual labels:  hook
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-36.84%)
Mutual labels:  hook
transition-hook
☄️ An extremely light-weight react transition animation hook which is simpler and easier to use than react-transition-group
Stars: ✭ 250 (+557.89%)
Mutual labels:  hook
30-seconds-of-react-zh CN-umi
React 30 秒速学: 精选有用的 React 片段。30-seconds-of-react 的中文版本,已全部完成翻译、上线。
Stars: ✭ 50 (+31.58%)
Mutual labels:  hook
Mimick.Fody
An integrated framework for dependency injection and aspect-oriented processing.
Stars: ✭ 15 (-60.53%)
Mutual labels:  aspect-oriented-programming
fastapi-pydiator
Python clean architecture and usecase implementation with fastapi and pydiator-core
Stars: ✭ 58 (+52.63%)
Mutual labels:  aspect-oriented-programming
react-hook-layout
Layouts in React.
Stars: ✭ 16 (-57.89%)
Mutual labels:  hook

KYHooker

KYHooker allows you adds block of code before/replace/after the selector,and you can manage the block with the identifer,remove or override the code you adds.

KYHooker extends NSObject with the following methods:

/**
 Adds a block of code before/replace/after the selector for a specific class with an identifer.
 You can remove or override the block of code for a specific hook with the identifer.
 
 @param isInstanceMethod the selector you want to hook is instance method or not
 @param block the code you wan to adds,block will return an invocation ,you can get the original method params from invocation
 - (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx;
 @note the first argument of the invocation is the object which calling the method,and the second argument is _cmd

 @return Hook success or not
 */

+ (BOOL)ky_hookSelector:(SEL)selector
    isInstanceMethod:(BOOL)isInstanceMethod
        position:(KYHookPosition)position
          identifier:(NSString *)identifier
              withBlock:(void(^ _Nullable )(NSInvocation *invocation))block;
/**
 Remove the block of code which added before/replace/after the selector for a specific class with an identifer.
 
 @param isInstanceMethod the selector you want to hook is instance method or not
 */

+ (void)ky_removeHookForSelector:(SEL)selector
                isInstanceMethod:(BOOL)isInstanceMethod
                      identifier:(NSString *)identifier;

Examples: here is the method we hooked:

+ (void)logMessage:(NSString *)message {
    NSLog(@"%@",message);
}

hook the method:

    [ViewController ky_hookSelector:@selector(logMessage:) isInstanceMethod:NO position:KYHookPositionAfter identifier:@"1" withBlock:^(NSInvocation *invocation){
        NSLog(@"I");
    }];
    [ViewController ky_hookSelector:@selector(logMessage:) isInstanceMethod:NO position:KYHookPositionAfter identifier:@"2" withBlock:^(NSInvocation *invocation){
        NSLog(@"Love");
    }];
    [ViewController ky_hookSelector:@selector(logMessage:) isInstanceMethod:NO position:KYHookPositionAfter identifier:@"3" withBlock:^(NSInvocation *invocation) {
        NSLog(@"Coding");
    }];
    [ViewController logMessage:@"hello world"];

the logs:

hello world
I
Love
Coding

you can override the block you adds by adding:

    [ViewController ky_hookSelector:@selector(logMessage:) isInstanceMethod:NO position:KYHookPositionAfter identifier:@"3" withBlock:^(NSInvocation *invocation) {
        NSLog(@"Girls");
    }];

the logs:

hello world
I
Love
Girls

and you can remove the block you adds by adding:

[ViewController ky_removeHookForSelector:@selector(logMessage:) isInstanceMethod:NO identifier:@"1"];

the logs:

hello world
Love
Girls
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].