mardi 24 juin 2014

Lazy Optional Property Always nil?


Vote count:

0




Is there a reason that the following code always prints out nil?



class Foo
{
@lazy var bar: Int? = 5
}

println(Foo().bar)


I would think that when the bar property is accessed it would be initialized to 5.



asked 40 secs ago






Aucun commentaire:

Enregistrer un commentaire