Support customizing reference type for Interpose object and bypass mode for Interpose initializer #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for your hard work and this AMAZING framework. This really saved me lots of time for dealing with the runtime, but I found that some of my needs couldn't be fulfilled without modifying the source code. So I opened this pull request discussing the possible solutions to solve the issues.
Customizing reference type
Issue
In my use case, I needed to make all hooks transparent thus I associate the interpose object with the hooked object. Obviously, it'll create a retain cycle.
Solution
I propose that we introduce a
ObjectContainer
that would hold the target object with customized reference type as I implemented in this pull request. So that we could initialize a Interpose object likeInitializer bypass mode
Issue
In the designed initializer of
Interpose
class, it's forced to validating the posing and actual class of the target object, which is really nice for preventing some unwanted errors. But I would say that it should be an optional tool rather than a constraint while being fully aware of the risk by hooking a isa-swizzled object.Solution
Add a bypass flag in initializers of
Interpose
class with default value true.