extension SendOfferVC : UITextViewDelegate { func textViewDidBeginEditing(_ textView: UITextView) { if textView.text == "Add a Description to your Offer" { textView.text = "" textView.textColor = UIColor.darkGray } } func textViewShouldEndEditing(_ textView: UITextView) -> Bool { if textView.text == "" { textView.text = "Add a Description to your Offer" textView.textColor = UIColor.lightGray } return true } func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if(text == "\n") { textView.resignFirstResponder() return false } return true } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter