Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Update for Swift 2.0 🎉 #7

Open
rodionovd opened this issue Jun 9, 2015 · 3 comments
Open

Update for Swift 2.0 🎉 #7

rodionovd opened this issue Jun 9, 2015 · 3 comments

Comments

@rodionovd
Copy link
Owner

I haven't touched this since the first Swift ßeta, so let's see what we have now.

@JianboYan
Copy link

hi rodionovd, i tried this Route with Swift 2.1.1, its not work for me(only last replace worked)... i ran the test and found that after run the SwiftRoute.replade method, the DemoClass().demoMethod did changed, but not the target address, for example, the original address of demoMethod is 0x10017fdd0, the closure address is 0x10017ff40, after replace, the demoMethod address will be 0x10573A6F0, as you see, even not both address we had.
Its also weird that when tests call demoMethod, it still call the original implementation...
hope you fix this issue and give me some help to understand that...

@rodionovd
Copy link
Owner Author

Hi @JianboYan, thanks for your feedback!

Yep indeed SWRoute doesn't work with modern versions of the language since it hasn't been updated for almost two years now 😓

hope you fix this issue and give me some help to understand that...

Unfortunately, I'm not really interested in this project anymore (I don't even use Swift at work), but I'd happily accept any PR that would bring it back to life!

Where to start

  • I guess the first step would be to update the codebase to modern syntax (afaik, there're no more CMutablePointers and some other stuff has changed drastically).
  • Then I'd take a look at how a function object is represented in memory (maybe its layout has also changed from Swift 1.0)

About the second step: there're two possible ways actually. Back in 2014 we didn't have a source code for the entire Swift project, so I had to use a disassembler for decompiling simple Swift applications and investigating how functions-as-arguments a passed into another functions. But now I believe one could easily look at the source code instead of guessing the language internals by inspecting compiled binaries.

Btw, if you have any questions — don't hesitate to ask me either here or by email (Twitter would also work for something short I guess) 😜

Hope this helps!

@JianboYan
Copy link

thx for your replying and the clue, i will have a try. 😄

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

No branches or pull requests

2 participants