Created
July 6, 2019 22:57
-
-
Save rsaenzi/8656cd4089ef356ce4c5964767a0cdc0 to your computer and use it in GitHub Desktop.
Set the Placeholder color of UITextfield for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // 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