[swift-evolution] Property Getter Return Statement

Tony Allevato tony.allevato at gmail.com
Sat Oct 7 11:47:13 CDT 2017


For what it's worth, you can drop the "get" part for read-only computed
properties and write:

    var session: AVCaptureSession { return layer.session }


On Sat, Oct 7, 2017 at 7:07 AM James Valaitis via swift-evolution <
swift-evolution at swift.org> wrote:

> Is it widely agreed that it is necessary to require a return statement on
> a one line property getter?
>
> var session: AVCaptureSession { get { return layer.session } }
>
> Or could we follow the convention for any other close and get rid of it?
> For me it seems redundant; the word `get` literally precedes the closure.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171007/b95c047d/attachment.html>


More information about the swift-evolution mailing list