[swift-users] Setting up properties
Erica Sadun
erica at ericasadun.com
Mon Dec 21 19:14:10 CST 2015
For a friend:
This won't work.
class DerpController {
private(set) var derp: Bool = {
return _findDerp() != nil
}()
private func _findDerp() -> AnyObject? {
return nil
}
}
but this works:
private func _findDerp() -> AnyObject? {
return nil
}
class DerpController {
private(set) var derp: Bool = {
return _findDerp() != nil
}()
}
Is it because the var member cannot depend on another member during setup? Thanks in advance for insight.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151221/aedc30e8/attachment.html>
More information about the swift-users
mailing list