[swift-users] Setting up properties

David Turnbull dturnbull at gmail.com
Mon Dec 21 21:15:40 CST 2015


You could be lazy about it...

    lazy private(set) var derp: Bool =  {

        [unowned self] in

        return self._findDerp() != nil

    }()

On Mon, Dec 21, 2015 at 6:54 PM, Erica Sadun via swift-users <
swift-users at swift.org> wrote:

> Thanks. Passed that along back.
>
> -- E
>
>
> On Dec 21, 2015, at 7:47 PM, Joe Groff <jgroff at apple.com> wrote:
>
> Yeah, instance methods can't be called until `self` is fully initialized,
> since they may themselves touch the uninitialized instance. In addition to
> making the function global, you could also make it a static method to
> preserve namespacing.
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151221/aca0555d/attachment.html>


More information about the swift-users mailing list