NSExceptional / Swizzle

A tweak to create basic tweaks from any app.
Other
42 stars 9 forks source link

[Help #5

Open WolfThatGoesMoo opened 6 years ago

WolfThatGoesMoo commented 6 years ago

Sorry, hit enter too soon and it posted anyway! This isn't an issue with it, but I'm trying to figure out where to post/ask for help. Everything is working wonderfully, I just have a question.

When I use select and select an alert for example, then click on view (within Flexing) it will take me to a long list of items, where I can eventually click on the little i in a circle to get details. I've gathered some information from it such as:

Details: <RCTView: 0x15924fb50; reactTag: 30; frame = (0 0; 375 667); layer = <CALayer: 0x159245ce0>

Shortcuts:

View Controller For Ancestor? @property BOOL Hidden 1 <----- I want to change this Class: +void(autoAdjustInsetsForView:(id) withScrollView:(id) updateOffset:(BOOL) +(UIEdgeInsets)contentInsetsForView:(id) Superclass: UIView UIResponder NSObject Now, I can just click on that property and change its value to false and it's hidden like I want, but I want to figure out how to use Swizzle to have that toggle'd on as a permanent tweak. This is what I've done: Added a "hook" which was App.name(app binary for bundle) --> RCTView (class) --> ...... and this is where I sort of get lost. Looking into the methods available for RCTView there doesn't seem to be a setter for IsHidden and I'm not sure what to do from there. I just want to be able to change this property value. Clicking on the property says @property(nonatomic, assign, readwrite, getter=isHidden) BOOL hidden. Can you please point me in the right direction to understanding where to go from here? I would really appreciate it, thank you! TLDR; How do you set a "Shortcuts" property value using Swizzle as a toggle/permanent tweak?
NSExceptional commented 6 years ago

Hey! You're good, this is fine for asking questions.

So, the "shortcuts" area is part of FLEX(ing), not swizzle, as you may know. The shortcuts just appear for certain classes like UIViews or UIViewControllers to make tinkering with certain properties quick and easy.

Anyway, you're on the right track. After that, you'd want to type *hidden to reveal methods containing the word "hidden". Searching for methods in swizzle can be confusing at first: how I intended it to work is that searching for -foo would search for instance methods beginning with "foo" while using + instead of - would search for class methods. To search for both, you can use the wildcard * operator.

Screenshot below showing the method you're looking for:

https://i.imgur.com/fL6enol.png

I have a feeling it won't work though, unless something is explicitly calling setHidden:. I'd try overriding them both to see if it works at all.

Note that RCTView is a react native view, which is used everywhere in react native apps: if it does work it will probably hide almost everything in the app!