
1 zenghaojim33 OP 这里中括号后面的(self)是什么意思?_? |
2 guitarkitten 2017-09-30 11:46:30 +08:00 { this in .... }(self) 这不就是一个调用么? |
3 abcyuxue123 2017-09-30 13:04:06 +08:00 感觉 ls +1 可以去掉 self 尝试运行,结果应该一样 |
4 zenghaojim33 OP |
5 NxiJSiOS 2017-09-30 14:16:50 +08:00 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-09-30 15:06:51 +08:00 via iPhone |
8 showme1121 2017-09-30 22:00:26 +08:00 via iPhone @zenghaojim33 this 是整个 closure 的参数啊 |
9 zenghaojim33 OP @showme1121 但是( self )又是什么 |
10 airdrop 2017-10-11 17:30:11 +08:00 closure 的调用吧 |
11 shawndev 2017-10-15 12:06:18 +08:00 lazy var button : UIButton = { $0.hide = true }(UIButton()) 和这种写法是一样的 |
12 zenghaojim33 OP @shawndev 明白了,那如果把 UIButton()放到闭包里面是不是一样的? |