Implementing UnitVC

The Unit view will allow editing of a unit’s name using a text field. When the view loads, the text field will be populated with the name of the unit that was selected on the table view. When the Done button is pressed, the view should be dismissed. UnitVC will be a UIViewController subclass and will implement this required functionality. The relevant header file is shown in Listing 6.8.

Listing 6.8 UnitVC.h

#import <UIKit/UIKit.h>#import "CoreDataHelper.h"@interface UnitVC : UIViewController <UITextFieldDelegate>@property (strong, nonatomic) NSManagedObjectID *selectedObjectID;@property (strong, nonatomic) IBOutlet UITextField *nameTextField;@end

Update Grocery Dude as follows to add the

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.