Properties are great. They allow us to write the more naturally looking

myButton.hidden = true

instead of

myButton.setHidden(true)

However, they don't take any parameters. That’s why we still have to write

myButton.setImage(myImage, forState: .Normal)

instead of

myButton.imageForState(.Normal) = myImage

The syntax to write such a function would be pretty straight-forward:

var imageForState(state: UIControlState): UIImage? {
    get { … }
    set { … }
}

Functions such as setHidden(_:forState:) are basically setters of properties, 
disguised as functions. This proposal would take away this ambiguity.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to