-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧪 Delegate Proxy & Runtime hacking #21
Conversation
via this protocol, we can set the delegate to the respected object
Awesome! Thanks or taking care of this, again :)
|
Would love to add some tests, but I am having a hard time figuring out how to unit tests Development pods. Any help is very much appreciated. |
Development pods specific are the issue? I think you can just do a |
Hey @freak4pc, I added some test for |
I'm gonna pull this into master so we can keep moving from there, seems solid enough and CI isn't actually running unless this would be merged, we can have another PR to add some more tests / clean this up, perhaps. |
|
||
private static func selectors(ofClass c: AnyClass, encodedReturnType: String) -> Set<Selector> { | ||
var protocolsCount: UInt32 = 0 | ||
guard let protocolPointer = class_copyProtocolList(c, &protocolsCount) else { return .init() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a memory leak here, forgot to defer free(protocolPointer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that seems correct. @jdisho can you look into this?
This is a very old thread but I wanted to share a relatively massive problem with this that I found while trying to use it in a newer project. When using the ScrollView proxy on a UICollectionView, the flow layout delegate is never called and the layout is entirely messed up. Not too sure why it's happening, tried to debug it unsuccessfully so far. I imagine you probably don't remember this implementation, but any chance you have an idea? @jdisho |
Generally speaking I might be missing something but I'm not seeing any form of forward delegation, I think this only intercepts the original delegate but it doesn't actually forward to the original delegate if such exists, basically overriding the original delegate ? |
Interesting ... 🤔 |
For more information have a look at #10