In this example, only iOS11 works.
import UIKit class VC: UIViewController { @IBOutlet weak var usernameTxt: UITextField! @IBOutlet weak var emailTxt: UITextField! @IBOutlet weak var passTxt: UITextField! override func viewDidLoad() { super.viewDidLoad() setupView() } func setupView() { usernameTxt.attributedPlaceholder = NSAttributedString(string: "username", attributes: [NSAttributedStringKey.foregroundColor: smackPurplePlaceholder]) emailTxt.attributedPlaceholder = NSAttributedString(string: "email", attributes: [NSAttributedStringKey.foregroundColor: smackPurplePlaceholder]) passTxt.attributedPlaceholder = NSAttributedString(string: "password", attributes: [NSAttributedStringKey.foregroundColor: smackPurplePlaceholder]) } }
source share