Skip to content
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

issue with Interception of a function in RAC5 #3382

Closed
porridgec opened this issue Jan 22, 2017 · 3 comments
Closed

issue with Interception of a function in RAC5 #3382

porridgec opened this issue Jan 22, 2017 · 3 comments
Labels

Comments

@porridgec
Copy link

I was trying to intercept a function named aFunc in my code but I failed.
And then I tried to do the same thing with the function viewWillAppear but this time the function was intercepted successfully.
The code and the log in console is shown below,I have been wondering and could anybody please help me out, thanks~

@ikesyo
Copy link
Member

ikesyo commented Jan 22, 2017

That is because the function is not marked as dynamic so we cannot intercept (swizzle) the implementation.

@andersio
Copy link
Member

To be more specific, Swift methods defined in NSObject subclasses (note: not extensions) by default do not use ObjC message sending. Unless you mark it as dynamic as @ikesyo said, it would use static or vtable dispatch.

@porridgec
Copy link
Author

Thanks for your reply,it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants