Created
September 25, 2017 08:59
-
-
Save jeop10/1333a499fffbaaf36bd4f2f1485bfb92 to your computer and use it in GitHub Desktop.
Add a Smack Purple color to the place holder text
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
| // | |
| // PurpleTextField.swift | |
| // Smack | |
| // | |
| // NOTE: | |
| // smackPurplePlaceHolder is a constant that you must have or change. | |
| import Foundation | |
| class PurpleTextField : UITextField { | |
| override func awakeFromNib() { | |
| setupView() | |
| } | |
| func setupView(){ | |
| var string = "" | |
| if let placeholder = self.placeholder { | |
| string = placeholder | |
| } | |
| self.attributedPlaceholder = NSAttributedString(string: string, attributes: [NSForegroundColorAttributeName : smackPurplePlaceHolder]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment