Basically, the table view is supposed to present the data of a data source.
In your case (in the medium example) the data source is of type ProfileViewModel which holds an array of items of type ProfileViewModelItem. Every cell presents the data of a single ProfileViewModelItem .
The way to retain the edited values is to change the item which is presented by the cell who's text field is being edited.
So every time a user types in a text field , you should change the data in the item (ProfileViewModelItem) which is holding the text that is being shown by the text field. That way the text field and the item are in sync and if the cell goes away , when it comes back on the screen , the text field will show the same text that is in the item , which is the same text that last appeared on the text field when the cell was last on screen.