Add Placeholder to UITextField, how to set the placeholder text programmatically in swift?

You need to get the phone number from your database first (convert them to String), then you set placeholder of your textField to that String, like so

 textField.placeholder = phoneNumberString

Swift 3

If your textField has text, you need to first set text property to nil, then set placeholder text:

textField.text = nil
textField.placeholder = "My Placeholder Text"

Important to note for anyone else reading this, setting placeholder text in the main.storyboard seems to nullify this solution, so I had to first clear out my placeholders in the storyboard before implementing this. Once that was done @Khuong and @Himanshu's answer worked perfectly.