import UIKit class PlaceHolderTextView:UITextView, UITextViewDelegate{ var placeholderText = "placeholderText" override func willMove(toSuperview newSuperview: UIView?) { textColor = .lightText delegate = self } func textViewDidBeginEditing(_ textView: UITextView) { if textView.text == placeholderText{ placeholderText = textView.text textView.text = "" textView.textColor = .darkText } } func textViewDidEndEditing(_ textView: UITextView) { if textView.text == ""{ textView.text = placeholderText textColor = .lightText } } }