I have a Table View Controller that is displaying a list of Messages. I want the user to be able to pick different sorting options for their Messages. Some possible sorting options might be most recent, read/unread, by sender, etc.
What I'm debating in my own mind is the proper way to manage the underlying list of Messages. Here is my current plan:
I have a custom MessageList Model object. I'll add a sortedBy property so that any Controller can check the current sorting method and resort the list if it needs to. The MessageList will have to be responsible for inserting new messages properly based on the current sorting method that has been chosen.
I like this approach because I don't have to make a sorted copy of the MessageList. It also keeps things simple for the Controller (indexPath.row == indexOfMessageInList).
Has anyone been in a similar situation and discovered a better approach?