[swift-users] lazy initialisation
owenzx at gmail.com
Mon Jul 4 12:21:44 CDT 2016
You'd better sharing some of you code here first.
On Tue, Jul 5, 2016 at 1:04 AM, J.E. Schotsman via swift-users <
swift-users at swift.org> wrote:
> I need to initialize a variable of a class with a closure using the value
> of some variables of the class.
> Since this is not permitted I thought I might solve the problem by
> declaring it lazy. But this is still rejected by the compiler.
> If there are no circular dependencies in initialization of lazy variables
> this could be allowed, couldn’t it?
> Or is this a very big if?
> My workaround is ugly: a calculated property + a private variable + an
> initialized:Bool variable.
> Jan E.
> swift-users mailing list
> swift-users at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users