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

Typhoon Injection By Type with Swift #248

Closed
kustosz opened this issue Sep 4, 2014 · 5 comments
Closed

Typhoon Injection By Type with Swift #248

kustosz opened this issue Sep 4, 2014 · 5 comments

Comments

@kustosz
Copy link

kustosz commented Sep 4, 2014

Hi all,

I've just noticed that it's impossible to use by-type property injections with Swift. Basically no class can be resolved at runtime. The problem seems to be that in Swift you need to prepend AppName. to class name for NSClassFromString. On the other hand, property_getAttributes returns type descriptor without this prefix.

One of the possible solutions I found would be to get the app prefix from the target injection class (using NSStringFromClass) and then trying to prepend this prefix to type property's type descriptor (if the current method fails to resolve the class).

Would you accept a PR with this? Or do you see a better solution for this problem?

@alexgarbarev
Copy link
Contributor

Thanks @kustosz. I already noticed that and did same fix. Try pod "typhoon", :head

@alexgarbarev
Copy link
Contributor

Here is the fix: c789d57

@jasperblues
Copy link
Member

Try one more time. There was a typing error got in there. Verified latest commit works for me.

@kustosz
Copy link
Author

kustosz commented Sep 4, 2014

Thanks guys, works like a charm!

@kustosz kustosz closed this as completed Sep 4, 2014
@jasperblues
Copy link
Member

Now available in Typhoon 2.2.1 (just pushed)

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

3 participants