DyCI / dyci-main

Dynamic Code Injection Tool for Objective-C
MIT License
1.12k stars 121 forks source link

Notifying all classes about injections #104

Closed DarthMike closed 9 years ago

DarthMike commented 9 years ago

Hi!

Thanks for awesome library! I've got a small question; In the notifier object SFInjectionsNotificationsCenter, objects are registered to update based on an injection of it's own class. This works perfectly fine, but I've had many times situations where I would like to reset views while working in interations injecting code.

For example: I would like to call reloadData on my viewcontroller when a cell has been changed by code injection.

Even though you can do this by registering to notification, I thought it would be better if SFInjectionsNotificationsCenter would notify all objects responding to the respective methods from SFInjectionObserver, not only the objects of the same class.

Would you accept a change doing this? I can easily do this if you want.

PaulTaykalo commented 9 years ago

I got the idea, not sure if it's really will be needed, but let's try from an example of pseudo-code how it will look like, when it will be done? And then we'll decide do we want to have it here or not :)

DarthMike commented 9 years ago

Hi, I implemented it temporarily to use myself in my fork: https://github.com/DarthMike/dyci-main/commit/e549737f6daed647999e0d6c756f473aff2a4eac

This will make that all objects get notification callbacks from any injection in the project. I understand it can be a performance problem if there's many objects alive, but I didn't see any problem using it in a big project.

PaulTaykalo commented 9 years ago

@DarthMike take a look at #105

PaulTaykalo commented 9 years ago

Fixed in #105