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

Swift property routing support? #4

Closed
delebedev opened this issue Jun 21, 2014 · 2 comments
Closed

Swift property routing support? #4

delebedev opened this issue Jun 21, 2014 · 2 comments

Comments

@delebedev
Copy link

In obj-c properties are syntactic sugar over setFoo: getFoo methods, but in Swift they are closer to ivars (at least from my knowledge). Is there any way to route them as well?

@rodionovd
Copy link
Owner

@garnett
Well… actually, setters and getters are shared between all instances of a class in Swift. They look like:

const int foo_offset = 0x48;

int getFoo(void *self)
{
    return *(uinptr_t *)(self + foo_offset);
}


void setFoo(int new_value, void *self)
{
    // there will be release/retain for non-scalar types 
    // ...
   *(uintptr_t *)(self + foo_offset) = new_value;
}

I don't know how can we hook setters/getters for only instance of the class…
So far I only have a way to obtain a shared setter/getter address, but it kinda useless.

@rodionovd rodionovd changed the title Property routing support? Swift property routing support? Jun 22, 2014
@rodionovd
Copy link
Owner

I've reopened this issue as rodionovd/SWRoute#3, because it's not about rd_route itself, but SWRoute.

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

No branches or pull requests

2 participants