How do I set a UITextField's borderColor?

ios, swift

Solution

@coderRed gave you an Objective C answer and a Swift answer. Ignore his first Line

I broke it up into 2 statements below in Swift:

let myColor : UIColor = UIColor( red: 0.5, green: 0.5, blue:0, alpha: 1.0 )
myTextField.layer.borderColor = myColor.CGColor

Hope this helps! Good luck with learning Swift

Problem

I am trying to set a `UITextField`'s `borderColor` in iOS 8 in Swift. I tried using this code: ``` myTextField.layer.borderColor = UIColor( red: 0.5, green: 0.5, blue:0, alpha: 1.0 ) ``` I got this error: UIColor not convertible to CGColor

Original source