Parse the server profile response and extract the taken_by field from iOS just like how you parsed the taken_info. By default the taken_by can be -1 indicating the the user is not taken by anyone.
Notice that the functionfunc tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell will get called multiple times to render each individual cell in order. You can learn more about tableView online. In general, allMessages contains all messages from all users. You can use indexPath to get the cell index and use that to get the information for the ith user that the current user is chatting with.
You might also need to do some research on how to make a table cell unclickable programmically, and how to grey-out a specific cell. Let me know if you have any question.
Here is an example (but you don't need to follow strictly to the UI layout, just make sure that we can distinguish out the taken user):
At this moment, the taken user might not be on the top of the chat list, but you don't need to concern about that now.
Notice that the function
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
will get called multiple times to render each individual cell in order. You can learn more about tableView online. In general, allMessages contains all messages from all users. You can use indexPath to get the cell index and use that to get the information for the ith user that the current user is chatting with.You might also need to do some research on how to make a table cell unclickable programmically, and how to grey-out a specific cell. Let me know if you have any question.
Here is an example (but you don't need to follow strictly to the UI layout, just make sure that we can distinguish out the taken user):
At this moment, the taken user might not be on the top of the chat list, but you don't need to concern about that now.