I have a simple SCTableViewModel in an SCTableViewController.
I am stumped, trying to properly save changes.
The model is generated using generateSectionsForObject:, passing a Parse User object and an appropriate SCClassDefinition.
The Parse User object contains a handful of NSString properties that I want to display and allow the user to edit.
It's effectively a single object editor, similar to an SCTableViewModel built with an SCUserDefaultsDefinition.
No detail views are generated, editing is taking place in the cells of the main table view.
The SCTableViewModel is displayed properly and I can edit the individual cells, but I can't figure out the correct way to hook into the SCT lifecycle to save the data.
Since I'm not an SCArrayOfItemsSection, I can't use the didUpdateItem action for a section.
I have made my SCTableViewController implement the SCTableViewModelDelegate protocol, setting self.TableViewModel.delegate = self in viewDidLoad.
- (void) tableViewModel:(SCTableViewModel *) tableViewModel itemEditedForSectionAtIndexPath:(NSIndexPath *)indexPath item:(NSObject *)item;
- (void)tableViewModel:(SCTableViewModel *)tableModel valueChangedForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableViewModel:(SCTableViewModel *)tableModel valueChangedForSectionAtIndex:(NSUInteger)index;
I've only put a logging statement in each of the above. Interestingly, only valueChangedForRowAtIndexPath appears to be getting called. It gets called at every change to a cell (every character change while a user is typing) so I don't really want to save the object in this method.
I suspect I could re-write the code using SCParseComDefinition, but it seems like there's a solution that I'm missing in my current implementation.