1
zenghaojim33 OP 这里中括号后面的(self)是什么意思?_?
|
2
guitarkitten 2017 年 9 月 30 日
{ this in .... }(self) 这不就是一个调用么?
|
3
abcyuxue123 2017 年 9 月 30 日
感觉 ls +1
可以去掉 self 尝试运行,结果应该一样 |
4
zenghaojim33 OP |
5
NxiJSiOS 2017 年 9 月 30 日
Since self is a struct you can ’ t create weak or unowned references. Instead, pass self to the closure or function that initialized the lazy variable.
|
6
zenghaojim33 OP @NxiJSiOS 貌似明白了点,就是在 struct 里面直接使用 self 的话会报错必须这样传进去?
|
7
engHacker 2017 年 9 月 30 日 via iPhone
@zenghaojim33 ❌
|
8
showme1121 2017 年 9 月 30 日 via iPhone
@zenghaojim33 this 是整个 closure 的参数啊
|
9
zenghaojim33 OP @showme1121 但是( self )又是什么
|
10
airdrop 2017 年 10 月 11 日
closure 的调用吧
|
11
shawndev 2017 年 10 月 15 日
lazy var button : UIButton = {
$0.hide = true }(UIButton()) 和这种写法是一样的 |
12
zenghaojim33 OP @shawndev 明白了,那如果把 UIButton()放到闭包里面是不是一样的?
|