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

在JS中使用swift类不起作用 #90

Closed
jokerping opened this issue Aug 25, 2015 · 4 comments
Closed

在JS中使用swift类不起作用 #90

jokerping opened this issue Aug 25, 2015 · 4 comments

Comments

@jokerping
Copy link

在swift类中定义了一个button 然后在js中打印一句话没有起作用,OC的就起作用

@leafduo
Copy link
Contributor

leafduo commented Aug 25, 2015

从原来上来说 swift 的类就没办法支持,尝试继承 NSObject 之类的吧

@bang590
Copy link
Owner

bang590 commented Aug 26, 2015

对 swift 不太了解,似乎 swift 实际的类名与定义的不一致,通过 NSClassFromString(@"类名") 无法获取到,但通过 NSClassFromString(@"项目名.类名") 可以。例如项目 demo 里用 swift 定义了 ViewController 类,在 JS 要这样写:

defineClass('demo.ViewController', {})

@jokerping
Copy link
Author

谢谢。问题已经解决

@bang590 bang590 closed this as completed Aug 30, 2015
@BeanDu
Copy link

BeanDu commented Dec 25, 2015

使用swift怎么解决的呢?@xz410236056

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

4 participants