How to create a custom property in theos / logos?

Is it possible to create a custom property using the hooked method using theos / logos?

Example:

//define my custom property @interface SBAwayController : NSObject { UIView *myCustomView; } @property (nonatomic, retain) UIView *myCustomView; @end %hook SBAwayController - (void)activate { //call original method %orig; //use my custom property if (tweakEnabled) [self.awayView addSubview:myCustomView]; } %end 

I tried this as discussed above, but was not successful.

+4
source share
1 answer

An alternative is to create a singleton class that will contain your object / context. Take this example from this hook class for laypersons . tracerStorage is a variable defined outside the class, and all interceptors access it.

To apply it to your case, you can have an external variable NSMutableDictionary with the current key SBAwayController as and the property myCustomView as the value.

0
source

Source: https://habr.com/ru/post/1495421/


All Articles