I've ran into a somewhat inconsistent behavior in regards to Implicit Member Expression in Swift:
import UIKit
let button = UIButton()
button.backgroundColor = .brownColor() # works
button.setTitleColor(.brownColor(), forState: .Normal) # doesn't work
button.setTitleColor(UIColor.brownColor(), forState: .Normal) # works
When using the leading dot notation in an assignment all works as expected. When using it as a parameter to a function however swift will throw a complier error (the playground just crashes). To complicate the situation, the UIControlState
enum properly inserts the implicit member expression value.
Is this a bug?
This was a bug and was fixed at least in the latest Swift version 2.1