ortuman / SwiftForms

A small and lightweight library written in Swift that allows you to easily create forms.
MIT License
1.33k stars 209 forks source link

placeholder text disappear when textfield is erased #162

Open ghost opened 7 years ago

ghost commented 7 years ago

how make sure the placeholder is always there if the user clear the text field.

RLRG commented 7 years ago

Hi @pprevalon:

What you have to do is to set the property of the cell "placeholder" to the value you want to appear in each cell.

So, for example, instead of the following line of code (taken from the example app SwiftFormsApplication):

row.configuration.cell.appearance = ["textField.placeholder" : "e.g. gethooksapp.com" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject]

You would need to code the following:

row.configuration.cell.appearance = ["textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] row.configuration.cell.placeholder = "e.g. gethooksapp.com"`

I will make a Pull Request now with the changes in the example app with this change ;)

I hope this helps !

Best regards,

RLRG

P.S.: I am new contributing to open-source projects so that I don't know how to close this issue, I suppose it is the admin of the repo the one responsible for doing it, isn't it?