Interface builder
- Add a
UITextView
control onto the nib or storyboard UIViewController - In the Identity Inspectorpane , select the class
PlaceholderTextView
- In the Attributes Inspector pane, there should be a "Placeholder" text field, which will let you set the placeholder text.
Note: There is an existing bug in interface builder which will cause this control to crash the preview engine. If this bothers you, remove @IBDesignable and @IBInspectable attributes, then set the placeholder property from code
Code Example
var textView = PlaceholderTextView(frame: CGRect(x: 0, y: 0, width: 300, height: 44))
textView.placeholder = "Username"
self.view.addSubview(textView)