No, it is not a bug.
For a closure, you have to call self explicitly unless the closure is mark
as @noescape. Also, in this situation, self is not unowned, as the closure
is not stored, it ran and released. Below, is a situation that you need use
unowned self. Here the closure is stored in
> On 4 Jul 2016, at 21:12, Mark Dalrymple via swift-users
> wrote:
>
> Here's the one I started with:
>
>lazy var c:Int = {return a*b}()
>
> and ended up with:
>
> lazy var c:Int = {return self.a * self.b}()
>
> It's in a closure, so need to explicitly
> On 04 Jul 2016, at 19:21, Zhao Xin wrote:
>
> You'd better sharing some of you code here first.
For example, consider this:
class TestStruct1
{
let a = 10
let b = 20
let c:Int = {return self.a*self.b}()
}
Of course this is a
This works for me
class Blorg: NSObject, URLSessionDelegate {
var config: URLSessionConfiguration
lazy var session: URLSession = {
print("howdy")
return URLSession(configuration: self.config, delegate: self,
delegateQueue: nil)
}()
override init() {
Everything is in the title.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
> Karen Stone wrote:
>> I believe there’s real value in being explicit about referencing class
>> members. It helps both the reader of the code and it makes writing code
>> with typical IDE conveniences like code completion less cluttered and more
>> informative. Unfamiliar class methods