Skip to content

Instantly share code, notes, and snippets.

@jeop10
Created September 25, 2017 08:59
Show Gist options
  • Select an option

  • Save jeop10/1333a499fffbaaf36bd4f2f1485bfb92 to your computer and use it in GitHub Desktop.

Select an option

Save jeop10/1333a499fffbaaf36bd4f2f1485bfb92 to your computer and use it in GitHub Desktop.
Add a Smack Purple color to the place holder text
//
// 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