Skip to content

Instantly share code, notes, and snippets.

@rsaenzi
Created July 6, 2019 22:57
Show Gist options
  • Select an option

  • Save rsaenzi/8656cd4089ef356ce4c5964767a0cdc0 to your computer and use it in GitHub Desktop.

Select an option

Save rsaenzi/8656cd4089ef356ce4c5964767a0cdc0 to your computer and use it in GitHub Desktop.
Set the Placeholder color of UITextfield for iOS
//
// Textfield+Placeholder.swift
//
// Created by Rigoberto Sáenz Imbacuán (https://www.linkedin.com/in/rsaenzi/)
// Copyright © 2019. All rights reserved.
//
import UIKit
extension UITextField {
func setPlaceholder(color: UIColor){
attributedPlaceholder = NSAttributedString(
string: placeholder!,
attributes: [NSAttributedString.Key.foregroundColor: color])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment