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

闭包传值 | 天寒地裂 #36

Open
Coldcrack opened this issue Oct 15, 2018 · 0 comments
Open

闭包传值 | 天寒地裂 #36

Coldcrack opened this issue Oct 15, 2018 · 0 comments

Comments

@Coldcrack
Copy link
Owner

http://www.coldcrack.me/2018/10/15/Closer_callBack/

闭包传值swift开发中常常遇到控制之间传值的问题,在oc中我们可以用通知、代理、block来传值。在oc的block传值很方便,缺点就是只能回调传值,如果要传多个控制器只能用通知了。而在swift中我们也可以用通知、代理来传值,但那样太麻烦了,swift有个很方便的回调叫闭包(closure)。swift闭包和oc的block很类似,它可以做方法的回调也可以用来做两个界面之间的传值,也可以叫两个

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

No branches or pull requests

1 participant