[swift-evolution] Some clarity lost from the great renaming

Brandon Knope bknope at me.com
Tue Oct 18 18:59:47 CDT 2016

I meant to bring this up a bit ago but just came across it again.

I find this to not read properly:

button.setTitle("Test", for: .normal) //for normal what?

The for argument is really only clear in meaning when you are typing it out and see that it is a UIControlState type. While reading it without this context is it as clear? .normal doesn't seem descriptive enough on its own.

Contrast this with UISegmentedControl:
segmented.dividerImage(forLeftSegmentState: .normal, rightSegmentState: .normal, barMetrics: .default)

Here the parameter labels are needed because there needs to be a distinction in the method between left and right. But here it is not forLeft: or forRight: it is the much more clear forLeftSegmentState:

So my question is: why was this not setTitle(forControlState:) or forButtonState, etc...?

Sent from my iPad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161018/7143d262/attachment.html>

More information about the swift-evolution mailing list