Is it possible to convert something from a text view into multiple rows in a tableview?

Hello there,

I am currently working on a todo list. The user can add single items to a tableview by typing something into a text view in a diffrent view controller. This input will be converted to a core data item and is displayed on the main page, which is a table view controller. I would like to improve the usability by creating the opportunity, to add multiple items at once. The user should be able to type in multiple items into a single textbox. But when they where added, they will be seperated in multple rows in the tableview. My question is, if that is programmatically possible, if so, how would this be implemented?

Replies

How would the different items be separated in the textView ?

Probably with a return or linefeed character ?


If so, you could:

- get the whole text

- parse it into an array (1 item for each line); that will be the dataSource for the tableView

var theItems : [String] = []

populate theItems by appending the parsed items

- In

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { }

you populate teh cell witrh theItems