Comments below
> Am 06.05.2016 um 13:48 schrieb Haravikk via swift-evolution
> :
>
> Actually a setter has more in common with a function, in which case the let
> implicit, the difference is that a setters type is also implicit. In fact,
> you don’t even need to
On May 6, 2016, at 4:09 AM, Ian Partridge via swift-evolution
wrote:
> Currently, the syntax for explicitly naming property setters is:
>
> set(newPerimeter) { // declares newPerimeter parameter, "let" not allowed
> sideLength = newPerimeter / 4.0
> }
>
Actually a setter has more in common with a function, in which case the let
implicit, the difference is that a setters type is also implicit. In fact, you
don’t even need to specify a name in a setter at all, as the default is
newValue and you can just use that.
I’m more curious whether we
Currently, the syntax for explicitly naming property setters is:
class Square {
var sideLength: Double = 0.0
var perimeter: Double {
get {
return sideLength * 4.0
}
set(newPerimeter) { // declares newPerimeter parameter, "let" not
allowed
sideLength = newPerimeter /