- Delete the existing SlapChat app from your iOS simulator. This will wipe any core data stuff you already have.
- Create a new Entity in your Data Model called 'Recipient'
- Recipient should have the following properties - name - email - phoneNumber - twitterHandle
- In your data model, 'Recipient' should have a to many relationship with 'Messages' and Message should have a to-one relationship with Recipient. In other words, a recipient can have many messages but a message can only have one recipient.
- Add a new
UITableViewController
that is made to list Recipients. So the standard fetchrequest stuff. Very similar to how you did the messagesTableViewController - When a user selects a recipient. It should segue to the messages table view controller and just show the messages for the selected recipient.
- Add in another Search view controller that will search recipients/messages. Search by different fields
Give our view controller in the storyboard an identifier. Do this the same way you give identifiers to segues. Then call instantiateViewControllerWithIdentifier(_:)
. That should help you out.
View Core Data SlapChat Relationships on Learn.co and start learning to code for free.