DetailViewController saving back 'items' info


#1

I’m hoping someone can help me understand the information flow here a little better:

I follow how from the didSelectRowAtIndexPath we acquire the item information and pass that along to the DetailViewController.

But I get a little lost when we pass the information back. I understand how the UILabels update the specific BNRItem, but how does BNRItemStore get updated with that instance of the modified BNRItem?

Thanks in advance!


#2

When you create a new item, it is added to the stores allItems array. When you use the detail view controller, one of those items in the allItems array is passed to the DetailViewController. This isn’t a copy or “modified” version of the BNRItem in the store - it is that item, so any changes made to it don’t have to be sent to the store because the sotre already has a pointer to that item.


#3

Pointer magic! As I continued to work through the chapters this started to make sense.