-1

How do I change the color of a UITextfield Placeholder in Swift 4? Seems like a simple task but I am having some trouble figuring it out as I am new programming and Swift. I want to change the color programmatically.

        tf.placeholder = "Name"
        tf.translatesAutoresizingMaskIntoConstraints = false
        UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.thin)
John
  • 965
  • 8
  • 16

1 Answers1

3
someTextField.attributedPlaceholder = NSAttributedString(string: "Placeholder text", attributes: [NSAttributedStringKey.foregroundColor: UIColor.red])
trndjc
  • 11,654
  • 3
  • 38
  • 51