From e54361660b52d2c656134d0232c787eae0d0ee75 Mon Sep 17 00:00:00 2001 From: shenayoshida Date: Sun, 4 Oct 2015 17:33:45 -0400 Subject: [PATCH 01/10] my project --- .DS_Store | Bin 0 -> 6148 bytes .../project.pbxproj | 361 ++++++++++++++++++ .../contents.xcworkspacedata | 2 +- .../CoreDataHomeworkPrep/.DS_Store | Bin 0 -> 6148 bytes .../CoreDataHomeworkPrep}/AppDelegate.h | 6 +- .../CoreDataHomeworkPrep}/AppDelegate.m | 14 +- .../AppIcon.appiconset/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 4 +- .../Base.lproj/Main.storyboard | 198 ++++++++++ .../.xccurrentversion | 2 +- .../CoreDataHomeworkPrep.xcdatamodel/contents | 22 ++ .../CoreDataHomeworkPrep}/Info.plist | 0 .../List+CoreDataProperties.h | 25 ++ .../List+CoreDataProperties.m | 21 + .../CoreDataHomeworkPrep/List.h | 22 ++ .../CoreDataHomeworkPrep/List.m | 15 + .../ListCreationTableViewController.h | 13 + .../ListCreationTableViewController.m | 72 ++++ .../ListsTableViewController.h | 13 + .../ListsTableViewController.m | 74 ++++ .../Task+CoreDataProperties.h | 28 ++ .../Task+CoreDataProperties.m | 24 ++ .../CoreDataHomeworkPrep/Task.h | 24 ++ .../CoreDataHomeworkPrep/Task.m | 16 + .../CoreDataHomeworkPrep}/main.m | 6 +- .../SavingForever.xcodeproj/project.pbxproj | 322 ---------------- .../SavingForever/Base.lproj/Main.storyboard | 25 -- .../SavingForever.xcdatamodel/contents | 4 - SavingForever/SavingForever/ViewController.h | 15 - SavingForever/SavingForever/ViewController.m | 27 -- 30 files changed, 946 insertions(+), 409 deletions(-) create mode 100644 .DS_Store create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.pbxproj rename {SavingForever/SavingForever.xcodeproj => CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (66%) create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/AppDelegate.h (81%) rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/AppDelegate.m (91%) rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/Base.lproj/LaunchScreen.storyboard (84%) create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard rename {SavingForever/SavingForever/SavingForever.xcdatamodeld => CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld}/.xccurrentversion (81%) create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/Info.plist (100%) create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m rename {SavingForever/SavingForever => CoreDataHomeworkPrep/CoreDataHomeworkPrep}/main.m (64%) delete mode 100644 SavingForever/SavingForever.xcodeproj/project.pbxproj delete mode 100644 SavingForever/SavingForever/Base.lproj/Main.storyboard delete mode 100644 SavingForever/SavingForever/SavingForever.xcdatamodeld/SavingForever.xcdatamodel/contents delete mode 100644 SavingForever/SavingForever/ViewController.h delete mode 100644 SavingForever/SavingForever/ViewController.m diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 + location = "self:CoreDataHomeworkPrep.xcodeproj"> diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..28d850ace939a066ce8fa25852848b02099ab61a GIT binary patch literal 6148 zcmeHKO-sW-5Pe%KR=o7+aXkw{PhLZf;8ExwP#URVLxQyEF~8Bj;2-hL2c;!?t5ReJ zX5Q}X%qII5G8q7Ax~?X`7{G`sI5?&GMr2*ICj<8kiAnb;@rV`m4oxpQ9EZq&+}#Ck zcweu0!uI{uoWH661^2qz;tKDWqw-s>xmq!5iE6o+%;rtq+7VAa_p@u=lx4ME&4G{W z%VXVp5ARwx)i3PYK5sLSjfk+pKrj#t93}&-*&?Ge!?3|XFc1uE7?AHnrV190ouPg@ zXtV_&%5S6!$I?qkPIfFDJ43EelBE(YHF=AXES>)BafM@NXz57ad?bHz@(v~G)46}v zaHPU8Y%mZE>@sj<)3Mb5+n@XY-K3ZW1Hr(*VjvC6SvlpAyteiZC$% diff --git a/SavingForever/SavingForever/AppDelegate.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m similarity index 91% rename from SavingForever/SavingForever/AppDelegate.m rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m index 29b2305..4e79a8f 100644 --- a/SavingForever/SavingForever/AppDelegate.m +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m @@ -1,11 +1,13 @@ // // AppDelegate.m -// SavingForever +// CoreDataHomeworkPrep // -// Created by Michael Kavouras on 10/4/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. // +// These are our excellent Core Data methods that were automatically created when we set up the project!! + #import "AppDelegate.h" @interface AppDelegate () @@ -51,7 +53,7 @@ - (void)applicationWillTerminate:(UIApplication *)application { @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; - (NSURL *)applicationDocumentsDirectory { - // The directory the application uses to store the Core Data store file. This code uses a directory named "com.mikekavouras.SavingForever" in the application's documents directory. + // The directory the application uses to store the Core Data store file. This code uses a directory named "shenayoshida.CoreDataHomeworkPrep" in the application's documents directory. return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; } @@ -60,7 +62,7 @@ - (NSManagedObjectModel *)managedObjectModel { if (_managedObjectModel != nil) { return _managedObjectModel; } - NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"SavingForever" withExtension:@"momd"]; + NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"CoreDataHomeworkPrep" withExtension:@"momd"]; _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; return _managedObjectModel; } @@ -74,7 +76,7 @@ - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { // Create the coordinator and store _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; - NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"SavingForever.sqlite"]; + NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataHomeworkPrep.sqlite"]; NSError *error = nil; NSString *failureReason = @"There was an error creating or loading the application's saved data."; if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { diff --git a/SavingForever/SavingForever/Assets.xcassets/AppIcon.appiconset/Contents.json b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from SavingForever/SavingForever/Assets.xcassets/AppIcon.appiconset/Contents.json rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/SavingForever/SavingForever/Base.lproj/LaunchScreen.storyboard b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/LaunchScreen.storyboard similarity index 84% rename from SavingForever/SavingForever/Base.lproj/LaunchScreen.storyboard rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/LaunchScreen.storyboard index 2e721e1..5a9c4a6 100644 --- a/SavingForever/SavingForever/Base.lproj/LaunchScreen.storyboard +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,7 @@ - + - + diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard new file mode 100644 index 0000000..4162bd3 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SavingForever/SavingForever/SavingForever.xcdatamodeld/.xccurrentversion b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion similarity index 81% rename from SavingForever/SavingForever/SavingForever.xcdatamodeld/.xccurrentversion rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion index 352ed15..b0ec248 100644 --- a/SavingForever/SavingForever/SavingForever.xcdatamodeld/.xccurrentversion +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - SavingForever.xcdatamodel + CoreDataHomeworkPrep.xcdatamodel diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents new file mode 100644 index 0000000..32500f3 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SavingForever/SavingForever/Info.plist b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Info.plist similarity index 100% rename from SavingForever/SavingForever/Info.plist rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/Info.plist diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h new file mode 100644 index 0000000..9611290 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h @@ -0,0 +1,25 @@ +// +// List+CoreDataProperties.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// +// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu +// to delete and recreate this implementation file for your updated model. +// + +#import "List.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface List (CoreDataProperties) + +@property (nullable, nonatomic, retain) NSString *title; +@property (nullable, nonatomic, retain) NSDate *createdAt; +@property (nullable, nonatomic, retain) id color; +@property (nullable, nonatomic, retain) NSArray *task; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m new file mode 100644 index 0000000..86d1772 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m @@ -0,0 +1,21 @@ +// +// List+CoreDataProperties.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// +// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu +// to delete and recreate this implementation file for your updated model. +// + +#import "List+CoreDataProperties.h" + +@implementation List (CoreDataProperties) + +@dynamic title; +@dynamic createdAt; +@dynamic color; +@dynamic task; + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h new file mode 100644 index 0000000..8eaacc6 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h @@ -0,0 +1,22 @@ +// +// List.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface List : NSManagedObject + +// Insert code here to declare functionality of your managed object subclass + +@end + +NS_ASSUME_NONNULL_END + +#import "List+CoreDataProperties.h" diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m new file mode 100644 index 0000000..8382435 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m @@ -0,0 +1,15 @@ +// +// List.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import "List.h" + +@implementation List + +// Insert code here to add functionality to your managed object subclass + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h new file mode 100644 index 0000000..a80b1af --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h @@ -0,0 +1,13 @@ +// +// ListCreationTableViewController.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import + +@interface ListCreationTableViewController : UITableViewController + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m new file mode 100644 index 0000000..1bef821 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m @@ -0,0 +1,72 @@ +// +// ListCreationTableViewController.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import +#import "ListCreationTableViewController.h" +#import "List.h" +#import "AppDelegate.h" // now we can access the core data methods that are built in + +@interface ListCreationTableViewController () + +@property (weak, nonatomic) IBOutlet UITextField *titleTextField; +@property (nonatomic) List *list; + +@end + +@implementation ListCreationTableViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + [self setupNavigationBar]; // set up navigation controls programatically + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // create variable that has accesss to our delegate + + self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; // alloc init list object in core data + + NSLog(@"%@", self.list); +} + +- (void)setupNavigationBar +{ + // set the title + self.navigationItem.title = @"Create New List"; + + // set the left button to cancel + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; + + // set the right button to save + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; +} + +- (void)cancel +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)save +{ + self.list.title = self.titleTextField.text; // set title + self.list.createdAt = [NSDate date]; + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + [delegate.managedObjectContext save:nil]; + + [self dismissViewControllerAnimated:YES completion:nil]; // dismiss view controller + + // NSLog(@"%@", self.list); // test it +} + +- (IBAction)colorButtonTapped:(UIButton *)sender +{ + self.list.color = sender.backgroundColor; +} + + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h new file mode 100644 index 0000000..d6596e4 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h @@ -0,0 +1,13 @@ +// +// ListsTableViewController.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import + +@interface ListsTableViewController : UITableViewController + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m new file mode 100644 index 0000000..798fbac --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m @@ -0,0 +1,74 @@ +// +// ListsTableViewController.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import +#import "ListsTableViewController.h" +#import "AppDelegate.h" +#import "List.h" + +@interface ListsTableViewController () + +@property (nonatomic) NSFetchedResultsController *fetchedResultsController; + +@end + +@implementation ListsTableViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + + // 1) create an instance of NSFetchRequest with an entity name + NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"List"]; + + // 2) create a sort descriptor + NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"createdAt" ascending:NO]; + + // 3) set the sortDescriptors on the fetchRequest + fetchRequest.sortDescriptors = @[sort]; + + // 4)create a fetchResultsController with a fetchRequest and a managedObjectObjectContext + self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; + + [self.fetchedResultsController performFetch:nil]; + + [self.tableView reloadData]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.fetchedResultsController.fetchedObjects.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"listCellIdentifier" forIndexPath:indexPath]; + + List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; + cell.textLabel.text = list.title; + cell.backgroundColor = (UIColor *)list.color; + cell.detailTextLabel.text = [list.createdAt description]; + + return cell; +} + +- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath +{ + [self.tableView reloadData]; +} + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h new file mode 100644 index 0000000..98c43f2 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h @@ -0,0 +1,28 @@ +// +// Task+CoreDataProperties.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// +// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu +// to delete and recreate this implementation file for your updated model. +// + +#import "Task.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Task (CoreDataProperties) + +@property (nullable, nonatomic, retain) NSString *taskDescription; +@property (nullable, nonatomic, retain) NSDate *createdAt; +@property (nullable, nonatomic, retain) NSDate *dueAt; +@property (nullable, nonatomic, retain) NSDate *updatedAt; +@property (nullable, nonatomic, retain) NSNumber *priority; +@property (nullable, nonatomic, retain) NSDate *completedAt; +@property (nullable, nonatomic, retain) List *list; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m new file mode 100644 index 0000000..c914d05 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m @@ -0,0 +1,24 @@ +// +// Task+CoreDataProperties.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// +// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu +// to delete and recreate this implementation file for your updated model. +// + +#import "Task+CoreDataProperties.h" + +@implementation Task (CoreDataProperties) + +@dynamic taskDescription; +@dynamic createdAt; +@dynamic dueAt; +@dynamic updatedAt; +@dynamic priority; +@dynamic completedAt; +@dynamic list; + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h new file mode 100644 index 0000000..0fcd3c0 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h @@ -0,0 +1,24 @@ +// +// Task.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import +#import + +@class List; + +NS_ASSUME_NONNULL_BEGIN + +@interface Task : NSManagedObject + +// Insert code here to declare functionality of your managed object subclass + +@end + +NS_ASSUME_NONNULL_END + +#import "Task+CoreDataProperties.h" diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m new file mode 100644 index 0000000..93f7648 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m @@ -0,0 +1,16 @@ +// +// Task.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import "Task.h" +#import "List.h" + +@implementation Task + +// Insert code here to add functionality to your managed object subclass + +@end diff --git a/SavingForever/SavingForever/main.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m similarity index 64% rename from SavingForever/SavingForever/main.m rename to CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m index 0d1314d..23be7c7 100644 --- a/SavingForever/SavingForever/main.m +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m @@ -1,9 +1,9 @@ // // main.m -// SavingForever +// CoreDataHomeworkPrep // -// Created by Michael Kavouras on 10/4/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. +// Created by Shena Yoshida on 10/4/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. // #import diff --git a/SavingForever/SavingForever.xcodeproj/project.pbxproj b/SavingForever/SavingForever.xcodeproj/project.pbxproj deleted file mode 100644 index cbf89e2..0000000 --- a/SavingForever/SavingForever.xcodeproj/project.pbxproj +++ /dev/null @@ -1,322 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8D2949671BC1D06E00FDC81F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D2949661BC1D06E00FDC81F /* main.m */; }; - 8D29496A1BC1D06E00FDC81F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D2949691BC1D06E00FDC81F /* AppDelegate.m */; }; - 8D29496D1BC1D06E00FDC81F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D29496C1BC1D06E00FDC81F /* ViewController.m */; }; - 8D2949701BC1D06E00FDC81F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D29496E1BC1D06E00FDC81F /* Main.storyboard */; }; - 8D2949731BC1D06E00FDC81F /* SavingForever.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 8D2949711BC1D06E00FDC81F /* SavingForever.xcdatamodeld */; }; - 8D2949751BC1D06E00FDC81F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D2949741BC1D06E00FDC81F /* Assets.xcassets */; }; - 8D2949781BC1D06E00FDC81F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D2949761BC1D06E00FDC81F /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 8D2949621BC1D06E00FDC81F /* SavingForever.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SavingForever.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D2949661BC1D06E00FDC81F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 8D2949681BC1D06E00FDC81F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 8D2949691BC1D06E00FDC81F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D29496B1BC1D06E00FDC81F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D29496C1BC1D06E00FDC81F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 8D29496F1BC1D06E00FDC81F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 8D2949721BC1D06E00FDC81F /* SavingForever.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SavingForever.xcdatamodel; sourceTree = ""; }; - 8D2949741BC1D06E00FDC81F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 8D2949771BC1D06E00FDC81F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 8D2949791BC1D06E00FDC81F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D29495F1BC1D06E00FDC81F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 8D2949591BC1D06D00FDC81F = { - isa = PBXGroup; - children = ( - 8D2949641BC1D06E00FDC81F /* SavingForever */, - 8D2949631BC1D06E00FDC81F /* Products */, - ); - sourceTree = ""; - }; - 8D2949631BC1D06E00FDC81F /* Products */ = { - isa = PBXGroup; - children = ( - 8D2949621BC1D06E00FDC81F /* SavingForever.app */, - ); - name = Products; - sourceTree = ""; - }; - 8D2949641BC1D06E00FDC81F /* SavingForever */ = { - isa = PBXGroup; - children = ( - 8D2949681BC1D06E00FDC81F /* AppDelegate.h */, - 8D2949691BC1D06E00FDC81F /* AppDelegate.m */, - 8D29496B1BC1D06E00FDC81F /* ViewController.h */, - 8D29496C1BC1D06E00FDC81F /* ViewController.m */, - 8D29496E1BC1D06E00FDC81F /* Main.storyboard */, - 8D2949741BC1D06E00FDC81F /* Assets.xcassets */, - 8D2949761BC1D06E00FDC81F /* LaunchScreen.storyboard */, - 8D2949791BC1D06E00FDC81F /* Info.plist */, - 8D2949711BC1D06E00FDC81F /* SavingForever.xcdatamodeld */, - 8D2949651BC1D06E00FDC81F /* Supporting Files */, - ); - path = SavingForever; - sourceTree = ""; - }; - 8D2949651BC1D06E00FDC81F /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 8D2949661BC1D06E00FDC81F /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D2949611BC1D06E00FDC81F /* SavingForever */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8D29497C1BC1D06E00FDC81F /* Build configuration list for PBXNativeTarget "SavingForever" */; - buildPhases = ( - 8D29495E1BC1D06E00FDC81F /* Sources */, - 8D29495F1BC1D06E00FDC81F /* Frameworks */, - 8D2949601BC1D06E00FDC81F /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SavingForever; - productName = SavingForever; - productReference = 8D2949621BC1D06E00FDC81F /* SavingForever.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 8D29495A1BC1D06D00FDC81F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - ORGANIZATIONNAME = "Michael Kavouras"; - TargetAttributes = { - 8D2949611BC1D06E00FDC81F = { - CreatedOnToolsVersion = 7.0.1; - }; - }; - }; - buildConfigurationList = 8D29495D1BC1D06D00FDC81F /* Build configuration list for PBXProject "SavingForever" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 8D2949591BC1D06D00FDC81F; - productRefGroup = 8D2949631BC1D06E00FDC81F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D2949611BC1D06E00FDC81F /* SavingForever */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D2949601BC1D06E00FDC81F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D2949781BC1D06E00FDC81F /* LaunchScreen.storyboard in Resources */, - 8D2949751BC1D06E00FDC81F /* Assets.xcassets in Resources */, - 8D2949701BC1D06E00FDC81F /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D29495E1BC1D06E00FDC81F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D29496D1BC1D06E00FDC81F /* ViewController.m in Sources */, - 8D29496A1BC1D06E00FDC81F /* AppDelegate.m in Sources */, - 8D2949671BC1D06E00FDC81F /* main.m in Sources */, - 8D2949731BC1D06E00FDC81F /* SavingForever.xcdatamodeld in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8D29496E1BC1D06E00FDC81F /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8D29496F1BC1D06E00FDC81F /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 8D2949761BC1D06E00FDC81F /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8D2949771BC1D06E00FDC81F /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 8D29497A1BC1D06E00FDC81F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 8D29497B1BC1D06E00FDC81F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 8D29497D1BC1D06E00FDC81F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = SavingForever/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.SavingForever; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 8D29497E1BC1D06E00FDC81F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = SavingForever/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.SavingForever; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 8D29495D1BC1D06D00FDC81F /* Build configuration list for PBXProject "SavingForever" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8D29497A1BC1D06E00FDC81F /* Debug */, - 8D29497B1BC1D06E00FDC81F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8D29497C1BC1D06E00FDC81F /* Build configuration list for PBXNativeTarget "SavingForever" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8D29497D1BC1D06E00FDC81F /* Debug */, - 8D29497E1BC1D06E00FDC81F /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - -/* Begin XCVersionGroup section */ - 8D2949711BC1D06E00FDC81F /* SavingForever.xcdatamodeld */ = { - isa = XCVersionGroup; - children = ( - 8D2949721BC1D06E00FDC81F /* SavingForever.xcdatamodel */, - ); - currentVersion = 8D2949721BC1D06E00FDC81F /* SavingForever.xcdatamodel */; - path = SavingForever.xcdatamodeld; - sourceTree = ""; - versionGroupType = wrapper.xcdatamodel; - }; -/* End XCVersionGroup section */ - }; - rootObject = 8D29495A1BC1D06D00FDC81F /* Project object */; -} diff --git a/SavingForever/SavingForever/Base.lproj/Main.storyboard b/SavingForever/SavingForever/Base.lproj/Main.storyboard deleted file mode 100644 index f56d2f3..0000000 --- a/SavingForever/SavingForever/Base.lproj/Main.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SavingForever/SavingForever/SavingForever.xcdatamodeld/SavingForever.xcdatamodel/contents b/SavingForever/SavingForever/SavingForever.xcdatamodeld/SavingForever.xcdatamodel/contents deleted file mode 100644 index 193f33c..0000000 --- a/SavingForever/SavingForever/SavingForever.xcdatamodeld/SavingForever.xcdatamodel/contents +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/SavingForever/SavingForever/ViewController.h b/SavingForever/SavingForever/ViewController.h deleted file mode 100644 index b193f94..0000000 --- a/SavingForever/SavingForever/ViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ViewController.h -// SavingForever -// -// Created by Michael Kavouras on 10/4/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/SavingForever/SavingForever/ViewController.m b/SavingForever/SavingForever/ViewController.m deleted file mode 100644 index 5f1f663..0000000 --- a/SavingForever/SavingForever/ViewController.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewController.m -// SavingForever -// -// Created by Michael Kavouras on 10/4/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end From 5755cc34254b80fa561abd8e6ffdd2867393cbf7 Mon Sep 17 00:00:00 2001 From: shenayoshida Date: Sun, 4 Oct 2015 17:49:43 -0400 Subject: [PATCH 02/10] fix table cells --- .DS_Store | Bin 6148 -> 6148 bytes CoreDataHomeworkPrep/.DS_Store | Bin 0 -> 6148 bytes .../ListsTableViewController.m | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 CoreDataHomeworkPrep/.DS_Store diff --git a/.DS_Store b/.DS_Store index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..d1a107ee777e2be9c7c43fc68b1adf1065a69030 100644 GIT binary patch delta 144 zcmZoMXfc=|&e%3FQEZ}~q9`K+0|O8XFfh0(jp@JRi delta 67 zcmZoMXfc=|&Zs)EP;8=}A_oHyFfuR*Y&_`3KJh}S5dOCIQ1Q}}c#=JN6zaums1ZC0eF3ErMGXnkqQ|_M@8Fa82!8WJX^EaH zqA~+B-|p-Sf4{;d87T(RFR)lFGe%f%dc zJ3ZOgUAKC_x~aZ(zxHnZyzh4Gu)#nu5Dfe+23WI2Mtg=~gMnZm7+5hN--k>UEF3#S z{dCZ13qX|LNEMEymyn$7SU7fuT%jaOC0c6o79&|Y{n_IR$Ij5wk-Ygx{^aBxO46ru z|E%Fig<;rWAQ;$WV8^CossHC+_y3zoF$)HQfq%t78kVzi$|HGg?Hx{PZKhsPMI^2> kT%~ZJrI@i&iVvtN^k*3m3&+lo9!mTOC=FqPfgfey1HQveTmS$7 literal 0 HcmV?d00001 diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m index 798fbac..5c8cbfe 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m @@ -23,8 +23,6 @@ - (void)viewDidLoad { [super viewDidLoad]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - // 1) create an instance of NSFetchRequest with an entity name NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"List"]; @@ -34,9 +32,13 @@ - (void)viewDidLoad // 3) set the sortDescriptors on the fetchRequest fetchRequest.sortDescriptors = @[sort]; + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + // 4)create a fetchResultsController with a fetchRequest and a managedObjectObjectContext self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; + self.fetchedResultsController.delegate = self; + [self.fetchedResultsController performFetch:nil]; [self.tableView reloadData]; From ab3c30594402b2658443b028644247b0304b50ec Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Tue, 6 Oct 2015 16:50:34 -0400 Subject: [PATCH 03/10] swapping files, basic framework added --- .DS_Store | Bin 6148 -> 6148 bytes CoreDataHomeworkPrep/.DS_Store | Bin 6148 -> 6148 bytes .../project.pbxproj | 361 ----------------- .../CoreDataHomeworkPrep/.DS_Store | Bin 6148 -> 6148 bytes .../Base.lproj/Main.storyboard | 93 ++++- .../ItemCreationTableViewController.h | 13 + .../ItemCreationTableViewController.m | 98 +++++ .../ItemsTableViewController.h | 21 + .../ItemsTableViewController.m | 105 +++++ .../ListsTableViewController.m | 28 +- MarsWater.xcodeproj/project.pbxproj | 373 ++++++++++++++++++ .../contents.xcworkspacedata | 2 +- 12 files changed, 728 insertions(+), 366 deletions(-) delete mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.pbxproj create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h create mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m create mode 100644 MarsWater.xcodeproj/project.pbxproj rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj => MarsWater.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (66%) diff --git a/.DS_Store b/.DS_Store index d1a107ee777e2be9c7c43fc68b1adf1065a69030..db71a4b57e6bd840b4c7ea30a6185f759ad8af23 100644 GIT binary patch literal 6148 zcmeHKPixdb6o1pMHQin!tx)hX*TN!ObXj{#w<&ljEJV79m2I*K?r1g>lB}^T3px8S z)K*V^20`iv5IlJEYk2d`pUTQAEFOxLdEvd^%gp>{lHcykWB`D4#^E-A4FDFpz*-%{ zZ%ot+pR*-hvVurtA1?S%px*~R*V+^q1&jj!ngU|(ZonSS*9;<&k*E6Wv9K8S?VH^!dXChtpG1c& zX90^@abm5Ct8Z^kCiiw)4cczCrVTo2x0?-m_fC5{wLe(at*zGX!NYX=^404%r)O{9 zeLPpc5Wxja+PcOI_=L&Af`$1Y4)7HPc^wXLWy~Olo?Im(%x}XB7@)=>YMtUeho|wA zZEwIwsT%M7^5V=9cinJY3;;gwd^wi<1;-rm@GqI^aQ11x$w5uHA`0lgxV3ggp4U94 zQNSp0c?yX2fuaj^G*$}b(t$x90T63gEDdvUmJl4O(a~5b#2PfBsECS6^bvz7I+j!2 z&e2#YRCFNv@Imy*M4wQI93A_ovN;e(p@~KTqrk5Uh;K_YTkQY)e?I@qMkW{qi~|3s z0;J}8ZU^5@@2zuhDfU{5evB?mw5t?K3I@F$%S3F&o9NQ8j*0})(O4CJzu~2NHo+2aT!~knX#>uvr7 zfQWN`UP)qRUTP7N)|l|j`n;6ayVQH$PU~Xz!tD{hDZf>BXU}9`uTPtvYgF{-=)X_Jxptft# z;w4L$Enji?DA0F6z{m)p8HAxU0|PgNbqq*>!-FHGI5{T?=!4CH%+pvlvvd6A2LO=@ BT|fW; delta 206 zcmZoMXfc@J&&aYdU^gQx3j+g#++;^)4Gji8h6;vchJ1z;hE#?Eh9V#q8c diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.pbxproj b/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.pbxproj deleted file mode 100644 index 44e7295..0000000 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.pbxproj +++ /dev/null @@ -1,361 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 4DD528E01BC1AE1D00D50DF9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD528DF1BC1AE1D00D50DF9 /* main.m */; }; - 4DD528E31BC1AE1D00D50DF9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD528E21BC1AE1D00D50DF9 /* AppDelegate.m */; }; - 4DD528E91BC1AE1D00D50DF9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4DD528E71BC1AE1D00D50DF9 /* Main.storyboard */; }; - 4DD528EC1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 4DD528EA1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodeld */; }; - 4DD528EE1BC1AE1D00D50DF9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4DD528ED1BC1AE1D00D50DF9 /* Assets.xcassets */; }; - 4DD528F11BC1AE1D00D50DF9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4DD528EF1BC1AE1D00D50DF9 /* LaunchScreen.storyboard */; }; - 4DD529041BC1B32000D50DF9 /* List+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD528FD1BC1B32000D50DF9 /* List+CoreDataProperties.m */; settings = {ASSET_TAGS = (); }; }; - 4DD529051BC1B32000D50DF9 /* List.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD528FF1BC1B32000D50DF9 /* List.m */; settings = {ASSET_TAGS = (); }; }; - 4DD529061BC1B32000D50DF9 /* Task+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD529011BC1B32000D50DF9 /* Task+CoreDataProperties.m */; settings = {ASSET_TAGS = (); }; }; - 4DD529071BC1B32000D50DF9 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD529031BC1B32000D50DF9 /* Task.m */; settings = {ASSET_TAGS = (); }; }; - 4DD5290B1BC1B8EC00D50DF9 /* ListsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD5290A1BC1B8EC00D50DF9 /* ListsTableViewController.m */; settings = {ASSET_TAGS = (); }; }; - 4DD5290E1BC1B91500D50DF9 /* ListCreationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD5290D1BC1B91500D50DF9 /* ListCreationTableViewController.m */; settings = {ASSET_TAGS = (); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 4DD528DB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreDataHomeworkPrep.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 4DD528DF1BC1AE1D00D50DF9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 4DD528E11BC1AE1D00D50DF9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 4DD528E21BC1AE1D00D50DF9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 4DD528E81BC1AE1D00D50DF9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 4DD528EB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = CoreDataHomeworkPrep.xcdatamodel; sourceTree = ""; }; - 4DD528ED1BC1AE1D00D50DF9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 4DD528F01BC1AE1D00D50DF9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 4DD528F21BC1AE1D00D50DF9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4DD528FC1BC1B32000D50DF9 /* List+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "List+CoreDataProperties.h"; sourceTree = ""; }; - 4DD528FD1BC1B32000D50DF9 /* List+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "List+CoreDataProperties.m"; sourceTree = ""; }; - 4DD528FE1BC1B32000D50DF9 /* List.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = List.h; sourceTree = ""; }; - 4DD528FF1BC1B32000D50DF9 /* List.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = List.m; sourceTree = ""; }; - 4DD529001BC1B32000D50DF9 /* Task+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Task+CoreDataProperties.h"; sourceTree = ""; }; - 4DD529011BC1B32000D50DF9 /* Task+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Task+CoreDataProperties.m"; sourceTree = ""; }; - 4DD529021BC1B32000D50DF9 /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Task.h; sourceTree = ""; }; - 4DD529031BC1B32000D50DF9 /* Task.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Task.m; sourceTree = ""; }; - 4DD529091BC1B8EC00D50DF9 /* ListsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListsTableViewController.h; sourceTree = ""; }; - 4DD5290A1BC1B8EC00D50DF9 /* ListsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListsTableViewController.m; sourceTree = ""; }; - 4DD5290C1BC1B91500D50DF9 /* ListCreationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListCreationTableViewController.h; sourceTree = ""; }; - 4DD5290D1BC1B91500D50DF9 /* ListCreationTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListCreationTableViewController.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 4DD528D81BC1AE1D00D50DF9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 4DD528D21BC1AE1D00D50DF9 = { - isa = PBXGroup; - children = ( - 4DD528DD1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep */, - 4DD528DC1BC1AE1D00D50DF9 /* Products */, - ); - sourceTree = ""; - }; - 4DD528DC1BC1AE1D00D50DF9 /* Products */ = { - isa = PBXGroup; - children = ( - 4DD528DB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.app */, - ); - name = Products; - sourceTree = ""; - }; - 4DD528DD1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep */ = { - isa = PBXGroup; - children = ( - 4DD528E71BC1AE1D00D50DF9 /* Main.storyboard */, - 4DD528EF1BC1AE1D00D50DF9 /* LaunchScreen.storyboard */, - 4DD528E11BC1AE1D00D50DF9 /* AppDelegate.h */, - 4DD528E21BC1AE1D00D50DF9 /* AppDelegate.m */, - 4DD529091BC1B8EC00D50DF9 /* ListsTableViewController.h */, - 4DD5290A1BC1B8EC00D50DF9 /* ListsTableViewController.m */, - 4DD5290C1BC1B91500D50DF9 /* ListCreationTableViewController.h */, - 4DD5290D1BC1B91500D50DF9 /* ListCreationTableViewController.m */, - 4DD528ED1BC1AE1D00D50DF9 /* Assets.xcassets */, - 4DD528F21BC1AE1D00D50DF9 /* Info.plist */, - 4DD528EA1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodeld */, - 4DD529081BC1B33E00D50DF9 /* Model */, - 4DD528DE1BC1AE1D00D50DF9 /* Supporting Files */, - ); - path = CoreDataHomeworkPrep; - sourceTree = ""; - }; - 4DD528DE1BC1AE1D00D50DF9 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 4DD528DF1BC1AE1D00D50DF9 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 4DD529081BC1B33E00D50DF9 /* Model */ = { - isa = PBXGroup; - children = ( - 4DD528FC1BC1B32000D50DF9 /* List+CoreDataProperties.h */, - 4DD528FD1BC1B32000D50DF9 /* List+CoreDataProperties.m */, - 4DD528FE1BC1B32000D50DF9 /* List.h */, - 4DD528FF1BC1B32000D50DF9 /* List.m */, - 4DD529001BC1B32000D50DF9 /* Task+CoreDataProperties.h */, - 4DD529011BC1B32000D50DF9 /* Task+CoreDataProperties.m */, - 4DD529021BC1B32000D50DF9 /* Task.h */, - 4DD529031BC1B32000D50DF9 /* Task.m */, - ); - name = Model; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 4DD528DA1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4DD528F51BC1AE1D00D50DF9 /* Build configuration list for PBXNativeTarget "CoreDataHomeworkPrep" */; - buildPhases = ( - 4DD528D71BC1AE1D00D50DF9 /* Sources */, - 4DD528D81BC1AE1D00D50DF9 /* Frameworks */, - 4DD528D91BC1AE1D00D50DF9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CoreDataHomeworkPrep; - productName = CoreDataHomeworkPrep; - productReference = 4DD528DB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 4DD528D31BC1AE1D00D50DF9 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - ORGANIZATIONNAME = "Shena Yoshida"; - TargetAttributes = { - 4DD528DA1BC1AE1D00D50DF9 = { - CreatedOnToolsVersion = 7.0; - DevelopmentTeam = 5F2A5ZZ575; - }; - }; - }; - buildConfigurationList = 4DD528D61BC1AE1D00D50DF9 /* Build configuration list for PBXProject "CoreDataHomeworkPrep" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 4DD528D21BC1AE1D00D50DF9; - productRefGroup = 4DD528DC1BC1AE1D00D50DF9 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 4DD528DA1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 4DD528D91BC1AE1D00D50DF9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4DD528F11BC1AE1D00D50DF9 /* LaunchScreen.storyboard in Resources */, - 4DD528EE1BC1AE1D00D50DF9 /* Assets.xcassets in Resources */, - 4DD528E91BC1AE1D00D50DF9 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 4DD528D71BC1AE1D00D50DF9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4DD528EC1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodeld in Sources */, - 4DD529061BC1B32000D50DF9 /* Task+CoreDataProperties.m in Sources */, - 4DD528E31BC1AE1D00D50DF9 /* AppDelegate.m in Sources */, - 4DD5290B1BC1B8EC00D50DF9 /* ListsTableViewController.m in Sources */, - 4DD529071BC1B32000D50DF9 /* Task.m in Sources */, - 4DD529051BC1B32000D50DF9 /* List.m in Sources */, - 4DD5290E1BC1B91500D50DF9 /* ListCreationTableViewController.m in Sources */, - 4DD529041BC1B32000D50DF9 /* List+CoreDataProperties.m in Sources */, - 4DD528E01BC1AE1D00D50DF9 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 4DD528E71BC1AE1D00D50DF9 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 4DD528E81BC1AE1D00D50DF9 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 4DD528EF1BC1AE1D00D50DF9 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 4DD528F01BC1AE1D00D50DF9 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 4DD528F31BC1AE1D00D50DF9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 4DD528F41BC1AE1D00D50DF9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 4DD528F61BC1AE1D00D50DF9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = CoreDataHomeworkPrep/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = shenayoshida.CoreDataHomeworkPrep; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 4DD528F71BC1AE1D00D50DF9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = CoreDataHomeworkPrep/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = shenayoshida.CoreDataHomeworkPrep; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 4DD528D61BC1AE1D00D50DF9 /* Build configuration list for PBXProject "CoreDataHomeworkPrep" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4DD528F31BC1AE1D00D50DF9 /* Debug */, - 4DD528F41BC1AE1D00D50DF9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 4DD528F51BC1AE1D00D50DF9 /* Build configuration list for PBXNativeTarget "CoreDataHomeworkPrep" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4DD528F61BC1AE1D00D50DF9 /* Debug */, - 4DD528F71BC1AE1D00D50DF9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - -/* Begin XCVersionGroup section */ - 4DD528EA1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodeld */ = { - isa = XCVersionGroup; - children = ( - 4DD528EB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodel */, - ); - currentVersion = 4DD528EB1BC1AE1D00D50DF9 /* CoreDataHomeworkPrep.xcdatamodel */; - path = CoreDataHomeworkPrep.xcdatamodeld; - sourceTree = ""; - versionGroupType = wrapper.xcdatamodel; - }; -/* End XCVersionGroup section */ - }; - rootObject = 4DD528D31BC1AE1D00D50DF9 /* Project object */; -} diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store index 28d850ace939a066ce8fa25852848b02099ab61a..d40ab7b643df32d3b29b2ca8c35e6d943d3e274d 100644 GIT binary patch delta 129 zcmZoMXfc@JFUrcmz`)4BAi%(&$B@HNz)-}H&ycmbka;L9_Cvto7p-3@&f?z!yjt^ delta 93 zcmZoMXfc@JFUrEez`)4BAi%)j!jQ;N0>mB+`I{#)FK1+AnXJ$3CXkbE7@VA+TL4rC o1niGNf|E}&aWk81vrg7!_LwZs3}$cEWxmBSu|aV&JI7ys0Gg~7b^rhX diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard index 4162bd3..ec7698b 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard @@ -21,6 +21,9 @@ + + + @@ -40,7 +43,7 @@ - + @@ -178,6 +181,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -192,7 +281,7 @@ - + diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h new file mode 100644 index 0000000..93c8fb0 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h @@ -0,0 +1,13 @@ +// +// ItemCreationTableViewController.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/5/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import + +@interface ItemCreationTableViewController : UITableViewController + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m new file mode 100644 index 0000000..37c1fbc --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m @@ -0,0 +1,98 @@ +// +// ItemCreationTableViewController.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/5/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import "ItemCreationTableViewController.h" + +@interface ItemCreationTableViewController () + +@end + +@implementation ItemCreationTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + +/* +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + + // Configure the cell... + + return cell; +} +*/ + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h new file mode 100644 index 0000000..f753bf1 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h @@ -0,0 +1,21 @@ +// +// ItemsTableViewController.h +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/5/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + +#import +#import "Task.h" +#import "ListsTableViewController.h" +#import "AppDelegate.h" + +@interface ItemsTableViewController : UITableViewController + +//@property (nonatomic) List *listTitle; // create property to hold title of to do list in segue +@property (nonatomic) Task *task; +@property (nonatomic) NSString *listName; +@property (nonatomic) id listColor; + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m new file mode 100644 index 0000000..2bd31a5 --- /dev/null +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m @@ -0,0 +1,105 @@ +// +// ItemsTableViewController.m +// CoreDataHomeworkPrep +// +// Created by Shena Yoshida on 10/5/15. +// Copyright © 2015 Shena Yoshida. All rights reserved. +// + + +#import "ItemsTableViewController.h" +#import "ItemCreationTableViewController.h" +#import + + + + + +@interface ItemsTableViewController () + +@property (nonatomic) NSFetchedResultsController *fetchedResultsController; +//@property (nonatomic) NSArray *array; + +@end + +@implementation ItemsTableViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + + + // NSLog(@"%@", self.listName); + + + + [self setupNavigationBar]; + [self fetchResults]; +} + +- (void)setupNavigationBar +{ + // set the title + // self.navigationItem.title = self.listName; + + // set the left button to cancel + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; + + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(createNewItem)]; +} + +- (void)cancel +{ + [self dismissViewControllerAnimated:YES completion:nil]; // dismiss when cancel button tapped +} + +- (void)createNewItem +{ + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; + UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"CreateItem"]; + [self presentViewController:navigationController animated:YES completion:nil]; + +} + +- (void)fetchResults +{ + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Task"]; + NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"createdAt" ascending:NO]; + fetchRequest.sortDescriptors = @[sort]; + + self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; + + self.fetchedResultsController.delegate = self; + + [self.fetchedResultsController performFetch:nil]; + + [self.tableView reloadData]; +} + + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"itemCellIdentifier" forIndexPath:indexPath]; + + // Configure the cell... + + return cell; +} + + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m index 5c8cbfe..fa3a6fa 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m +++ b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m @@ -10,10 +10,13 @@ #import "ListsTableViewController.h" #import "AppDelegate.h" #import "List.h" +#import "ItemsTableViewController.h" + @interface ListsTableViewController () @property (nonatomic) NSFetchedResultsController *fetchedResultsController; +@property (nonatomic) NSString *listTitleForHeading; @end @@ -23,6 +26,8 @@ - (void)viewDidLoad { [super viewDidLoad]; + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + // 1) create an instance of NSFetchRequest with an entity name NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"List"]; @@ -32,8 +37,6 @@ - (void)viewDidLoad // 3) set the sortDescriptors on the fetchRequest fetchRequest.sortDescriptors = @[sort]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - // 4)create a fetchResultsController with a fetchRequest and a managedObjectObjectContext self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; @@ -73,4 +76,25 @@ - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id) [self.tableView reloadData]; } +#pragma mark - prepareForSegue + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +{ + if ([[segue identifier] isEqualToString:@"showListName"]) { // create reference to segue title + + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; // grab dictionary of fetched items + ItemsTableViewController *detailController = segue.destinationViewController; + + NSLog(@"hello!!!! %@", list); + + // self.listTitleForHeading = list.title; + // NSLog(@"%@", self.listTitleForHeading); + + // detailController.listName = list.title; + // NSLog(@"%@", list.title); + // detailController.listColor = (UIColor *)list.color; + + } +} @end diff --git a/MarsWater.xcodeproj/project.pbxproj b/MarsWater.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2f62824 --- /dev/null +++ b/MarsWater.xcodeproj/project.pbxproj @@ -0,0 +1,373 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 4D53AEFC1BC441430084EFE8 /* TaskTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + 4D53AEFF1BC45C5F0084EFE8 /* TaskCreationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + 8DA86CA91BC1AE57006C50BC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CA81BC1AE57006C50BC /* main.m */; }; + 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CAB1BC1AE57006C50BC /* AppDelegate.m */; }; + 8DA86CB21BC1AE57006C50BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DA86CB01BC1AE57006C50BC /* Main.storyboard */; }; + 8DA86CB51BC1AE57006C50BC /* MarsWater.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CB31BC1AE57006C50BC /* MarsWater.xcdatamodeld */; }; + 8DA86CB71BC1AE57006C50BC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DA86CB61BC1AE57006C50BC /* Assets.xcassets */; }; + 8DA86CBA1BC1AE57006C50BC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DA86CB81BC1AE57006C50BC /* LaunchScreen.storyboard */; }; + 8DA86CD41BC1B8E4006C50BC /* ListsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CD31BC1B8E4006C50BC /* ListsTableViewController.m */; }; + 8DA86CD71BC1B904006C50BC /* ListCreationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CD61BC1B904006C50BC /* ListCreationTableViewController.m */; }; + 8DB2F6E71BC1E75500E58E65 /* List.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DB2F6E01BC1E75500E58E65 /* List.m */; }; + 8DB2F6E81BC1E75500E58E65 /* List+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DB2F6E21BC1E75500E58E65 /* List+CoreDataProperties.m */; }; + 8DB2F6E91BC1E75500E58E65 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DB2F6E41BC1E75500E58E65 /* Task.m */; }; + 8DB2F6EA1BC1E75500E58E65 /* Task+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DB2F6E61BC1E75500E58E65 /* Task+CoreDataProperties.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 4D53AEFA1BC441430084EFE8 /* TaskTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskTableViewController.h; sourceTree = ""; }; + 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskTableViewController.m; sourceTree = ""; }; + 4D53AEFD1BC45C5F0084EFE8 /* TaskCreationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskCreationTableViewController.h; sourceTree = ""; }; + 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskCreationTableViewController.m; sourceTree = ""; }; + 8DA86CA41BC1AE57006C50BC /* MarsWater.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarsWater.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DA86CA81BC1AE57006C50BC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 8DA86CAA1BC1AE57006C50BC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 8DA86CAB1BC1AE57006C50BC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 8DA86CB11BC1AE57006C50BC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 8DA86CB41BC1AE57006C50BC /* MarsWater.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MarsWater.xcdatamodel; sourceTree = ""; }; + 8DA86CB61BC1AE57006C50BC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 8DA86CB91BC1AE57006C50BC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 8DA86CBB1BC1AE57006C50BC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DA86CD21BC1B8E4006C50BC /* ListsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListsTableViewController.h; sourceTree = ""; }; + 8DA86CD31BC1B8E4006C50BC /* ListsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListsTableViewController.m; sourceTree = ""; }; + 8DA86CD51BC1B904006C50BC /* ListCreationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListCreationTableViewController.h; sourceTree = ""; }; + 8DA86CD61BC1B904006C50BC /* ListCreationTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListCreationTableViewController.m; sourceTree = ""; }; + 8DB2F6DF1BC1E75500E58E65 /* List.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = List.h; sourceTree = ""; }; + 8DB2F6E01BC1E75500E58E65 /* List.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = List.m; sourceTree = ""; }; + 8DB2F6E11BC1E75500E58E65 /* List+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "List+CoreDataProperties.h"; sourceTree = ""; }; + 8DB2F6E21BC1E75500E58E65 /* List+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "List+CoreDataProperties.m"; sourceTree = ""; }; + 8DB2F6E31BC1E75500E58E65 /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Task.h; sourceTree = ""; }; + 8DB2F6E41BC1E75500E58E65 /* Task.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Task.m; sourceTree = ""; }; + 8DB2F6E51BC1E75500E58E65 /* Task+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Task+CoreDataProperties.h"; sourceTree = ""; }; + 8DB2F6E61BC1E75500E58E65 /* Task+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Task+CoreDataProperties.m"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DA86CA11BC1AE57006C50BC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8DA86C9B1BC1AE57006C50BC = { + isa = PBXGroup; + children = ( + 8DA86CA61BC1AE57006C50BC /* MarsWater */, + 8DA86CA51BC1AE57006C50BC /* Products */, + ); + sourceTree = ""; + }; + 8DA86CA51BC1AE57006C50BC /* Products */ = { + isa = PBXGroup; + children = ( + 8DA86CA41BC1AE57006C50BC /* MarsWater.app */, + ); + name = Products; + sourceTree = ""; + }; + 8DA86CA61BC1AE57006C50BC /* MarsWater */ = { + isa = PBXGroup; + children = ( + 8DA86CD11BC1B329006C50BC /* Model */, + 8DA86CAA1BC1AE57006C50BC /* AppDelegate.h */, + 8DA86CAB1BC1AE57006C50BC /* AppDelegate.m */, + 8DA86CD21BC1B8E4006C50BC /* ListsTableViewController.h */, + 8DA86CD31BC1B8E4006C50BC /* ListsTableViewController.m */, + 8DA86CD51BC1B904006C50BC /* ListCreationTableViewController.h */, + 8DA86CD61BC1B904006C50BC /* ListCreationTableViewController.m */, + 4D53AEFA1BC441430084EFE8 /* TaskTableViewController.h */, + 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */, + 4D53AEFD1BC45C5F0084EFE8 /* TaskCreationTableViewController.h */, + 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */, + 8DA86CB01BC1AE57006C50BC /* Main.storyboard */, + 8DA86CB61BC1AE57006C50BC /* Assets.xcassets */, + 8DA86CB81BC1AE57006C50BC /* LaunchScreen.storyboard */, + 8DA86CBB1BC1AE57006C50BC /* Info.plist */, + 8DA86CB31BC1AE57006C50BC /* MarsWater.xcdatamodeld */, + 8DA86CA71BC1AE57006C50BC /* Supporting Files */, + ); + path = MarsWater; + sourceTree = ""; + }; + 8DA86CA71BC1AE57006C50BC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8DA86CA81BC1AE57006C50BC /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 8DA86CD11BC1B329006C50BC /* Model */ = { + isa = PBXGroup; + children = ( + 8DB2F6DF1BC1E75500E58E65 /* List.h */, + 8DB2F6E01BC1E75500E58E65 /* List.m */, + 8DB2F6E11BC1E75500E58E65 /* List+CoreDataProperties.h */, + 8DB2F6E21BC1E75500E58E65 /* List+CoreDataProperties.m */, + 8DB2F6E31BC1E75500E58E65 /* Task.h */, + 8DB2F6E41BC1E75500E58E65 /* Task.m */, + 8DB2F6E51BC1E75500E58E65 /* Task+CoreDataProperties.h */, + 8DB2F6E61BC1E75500E58E65 /* Task+CoreDataProperties.m */, + ); + name = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DA86CA31BC1AE57006C50BC /* MarsWater */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8DA86CBE1BC1AE57006C50BC /* Build configuration list for PBXNativeTarget "MarsWater" */; + buildPhases = ( + 8DA86CA01BC1AE57006C50BC /* Sources */, + 8DA86CA11BC1AE57006C50BC /* Frameworks */, + 8DA86CA21BC1AE57006C50BC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MarsWater; + productName = MarsWater; + productReference = 8DA86CA41BC1AE57006C50BC /* MarsWater.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8DA86C9C1BC1AE57006C50BC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = "Michael Kavouras"; + TargetAttributes = { + 8DA86CA31BC1AE57006C50BC = { + CreatedOnToolsVersion = 7.0.1; + }; + }; + }; + buildConfigurationList = 8DA86C9F1BC1AE57006C50BC /* Build configuration list for PBXProject "MarsWater" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 8DA86C9B1BC1AE57006C50BC; + productRefGroup = 8DA86CA51BC1AE57006C50BC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DA86CA31BC1AE57006C50BC /* MarsWater */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DA86CA21BC1AE57006C50BC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DA86CBA1BC1AE57006C50BC /* LaunchScreen.storyboard in Resources */, + 8DA86CB71BC1AE57006C50BC /* Assets.xcassets in Resources */, + 8DA86CB21BC1AE57006C50BC /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DA86CA01BC1AE57006C50BC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DA86CB51BC1AE57006C50BC /* MarsWater.xcdatamodeld in Sources */, + 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */, + 4D53AEFF1BC45C5F0084EFE8 /* TaskCreationTableViewController.m in Sources */, + 4D53AEFC1BC441430084EFE8 /* TaskTableViewController.m in Sources */, + 8DB2F6EA1BC1E75500E58E65 /* Task+CoreDataProperties.m in Sources */, + 8DA86CD41BC1B8E4006C50BC /* ListsTableViewController.m in Sources */, + 8DB2F6E71BC1E75500E58E65 /* List.m in Sources */, + 8DB2F6E91BC1E75500E58E65 /* Task.m in Sources */, + 8DA86CD71BC1B904006C50BC /* ListCreationTableViewController.m in Sources */, + 8DA86CA91BC1AE57006C50BC /* main.m in Sources */, + 8DB2F6E81BC1E75500E58E65 /* List+CoreDataProperties.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 8DA86CB01BC1AE57006C50BC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DA86CB11BC1AE57006C50BC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 8DA86CB81BC1AE57006C50BC /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DA86CB91BC1AE57006C50BC /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 8DA86CBC1BC1AE57006C50BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 8DA86CBD1BC1AE57006C50BC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 8DA86CBF1BC1AE57006C50BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = MarsWater/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.MarsWater; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8DA86CC01BC1AE57006C50BC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = MarsWater/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.MarsWater; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8DA86C9F1BC1AE57006C50BC /* Build configuration list for PBXProject "MarsWater" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DA86CBC1BC1AE57006C50BC /* Debug */, + 8DA86CBD1BC1AE57006C50BC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8DA86CBE1BC1AE57006C50BC /* Build configuration list for PBXNativeTarget "MarsWater" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DA86CBF1BC1AE57006C50BC /* Debug */, + 8DA86CC01BC1AE57006C50BC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 8DA86CB31BC1AE57006C50BC /* MarsWater.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 8DA86CB41BC1AE57006C50BC /* MarsWater.xcdatamodel */, + ); + currentVersion = 8DA86CB41BC1AE57006C50BC /* MarsWater.xcdatamodel */; + path = MarsWater.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 8DA86C9C1BC1AE57006C50BC /* Project object */; +} diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MarsWater.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 66% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to MarsWater.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 0d0e5a1..4acdfe2 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/MarsWater.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:MarsWater.xcodeproj"> From 2618a5a117aa2d98b9842c61751a115daab29246 Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Tue, 6 Oct 2015 16:55:10 -0400 Subject: [PATCH 04/10] added missing files --- .DS_Store | Bin 6148 -> 6148 bytes .../CoreDataHomeworkPrep/.DS_Store | Bin 6148 -> 0 bytes .../ItemCreationTableViewController.h | 13 - .../ItemsTableViewController.h | 21 - {CoreDataHomeworkPrep => MarsWater}/.DS_Store | Bin 6148 -> 6148 bytes .../AppDelegate.h | 6 +- .../AppDelegate.m | 14 +- .../AppIcon.appiconset/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 379 ++++++++++-------- .../Info.plist | 0 .../List+CoreDataProperties.h | 6 +- .../List+CoreDataProperties.m | 6 +- .../CoreDataHomeworkPrep => MarsWater}/List.h | 6 +- .../CoreDataHomeworkPrep => MarsWater}/List.m | 6 +- .../ListCreationTableViewController.h | 6 +- .../ListCreationTableViewController.m | 43 +- .../ListsTableViewController.h | 6 +- .../ListsTableViewController.m | 57 ++- .../MarsWater.xcdatamodeld}/.xccurrentversion | 2 +- .../MarsWater.xcdatamodel}/contents | 6 +- .../Task+CoreDataProperties.h | 6 +- .../Task+CoreDataProperties.m | 6 +- .../CoreDataHomeworkPrep => MarsWater}/Task.h | 6 +- .../CoreDataHomeworkPrep => MarsWater}/Task.m | 6 +- MarsWater/TaskCreationTableViewController.h | 13 + .../TaskCreationTableViewController.m | 71 +++- MarsWater/TaskTableViewController.h | 20 + .../TaskTableViewController.m | 59 +-- .../CoreDataHomeworkPrep => MarsWater}/main.m | 8 +- 30 files changed, 403 insertions(+), 369 deletions(-) delete mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/.DS_Store delete mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h delete mode 100644 CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h rename {CoreDataHomeworkPrep => MarsWater}/.DS_Store (80%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/AppDelegate.h (81%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/AppDelegate.m (91%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Base.lproj/LaunchScreen.storyboard (100%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Base.lproj/Main.storyboard (55%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Info.plist (100%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/List+CoreDataProperties.h (81%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/List+CoreDataProperties.m (73%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/List.h (69%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/List.m (53%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/ListCreationTableViewController.h (54%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/ListCreationTableViewController.m (59%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/ListsTableViewController.h (51%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/ListsTableViewController.m (70%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld => MarsWater/MarsWater.xcdatamodeld}/.xccurrentversion (81%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel => MarsWater/MarsWater.xcdatamodeld/MarsWater.xcdatamodel}/contents (87%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Task+CoreDataProperties.h (85%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Task+CoreDataProperties.m (77%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Task.h (70%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/Task.m (55%) create mode 100644 MarsWater/TaskCreationTableViewController.h rename CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m => MarsWater/TaskCreationTableViewController.m (56%) create mode 100644 MarsWater/TaskTableViewController.h rename CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m => MarsWater/TaskTableViewController.m (68%) rename {CoreDataHomeworkPrep/CoreDataHomeworkPrep => MarsWater}/main.m (63%) diff --git a/.DS_Store b/.DS_Store index db71a4b57e6bd840b4c7ea30a6185f759ad8af23..6c2c49cf78ef47141276208edbf0d899463798f7 100644 GIT binary patch delta 105 zcmZoMXfc=|#>B)qu~2NHo}wr#0|Nsi1A_nqLpVbsLkUAFLs3fc#=_-{;vgAL24A3P u5koOTc5^1{Jf@8e?#!FnIruq%25lDP_|80;U&N6Er~zaa%jO7?HOv5S;uTl` delta 443 zcmZoMXfc=|#>B!ku~2NHo}wrl0|Nsi1A_nqg9}3E*$e?-*@C3<;)0}{{3M{BpGgHdnZ+dr1~(a*m|0la*f}`4xIs`r zkSjJgBfmVjB(bEl*eS6n8qCW~Nlk*X0}@LzVC?#k{QMjkCnPZ`EHkw{UO>b-Kd&S) zGcUCWNpDPeW?o8uxl?{=UP^IHFvP&{%#@OhcmdIXqSP{=)_}yk)UeFr%%sem%#unD zP7sV2kf^SGv^Vv@FPKsjyE?sG7ThQ58b< zIGL7B-6{v8)9qBPo1zHIMG1VI-@M1#TX@#G2|rM^eOhP0D-mXm0b{@z_!S1&vqeTn zie`-gW55_#F(BUuPZi7(c8c-SK@&#+;*jnryp~x)a(u!pVW-F)iqll0rn)p@I8CSD zr?@O(r>N<0Y4~vI&Mr+TF5aE>eGG@o6wMj~#=s^6d%7G;|G)fx{@+Zpl`&up{3{0B zu$UG(Un%w0-pfg^_0(Ich{Sb@s}x?uR?Jvw#mCer^n1A=W(hk*dMNfI5NR-D4D6JF EPbnH%A^-pY diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h deleted file mode 100644 index 93c8fb0..0000000 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ItemCreationTableViewController.h -// CoreDataHomeworkPrep -// -// Created by Shena Yoshida on 10/5/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. -// - -#import - -@interface ItemCreationTableViewController : UITableViewController - -@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h b/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h deleted file mode 100644 index f753bf1..0000000 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ItemsTableViewController.h -// CoreDataHomeworkPrep -// -// Created by Shena Yoshida on 10/5/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. -// - -#import -#import "Task.h" -#import "ListsTableViewController.h" -#import "AppDelegate.h" - -@interface ItemsTableViewController : UITableViewController - -//@property (nonatomic) List *listTitle; // create property to hold title of to do list in segue -@property (nonatomic) Task *task; -@property (nonatomic) NSString *listName; -@property (nonatomic) id listColor; - -@end diff --git a/CoreDataHomeworkPrep/.DS_Store b/MarsWater/.DS_Store similarity index 80% rename from CoreDataHomeworkPrep/.DS_Store rename to MarsWater/.DS_Store index 54564bcab9d0643ea3af8700b4013e0903e820cf..44339e22786ea1e0f133439ded55b6f372a43b79 100644 GIT binary patch delta 305 zcmZoMXfc@JFUrEez`)4BAi%&7&XCAZ!jQ^P#Gtpika;;{JxEH7!51i8#88YZ%}~LR z%#Z?Bp2(2PkPl?1GUPC%i%UvrNiqY&CChEW^&mq? gH6R7a0MhjrWFUEfi9rDv4%1jBHl%H4=lIJH07Sb$RR910 delta 404 zcmZoMXfc@JFUrKgz`)4BAi%)j!jQ;N0>mB+`I`lqmorW_5MikoVQ^;1XDDJwMV4mB z1@gay zVQH$PU~Xz!tD{hDZf>BXU}9`uTPtvYgF{*~#njO^vY@tW(c&dbmn~m$_$bhOK)?tL iF)$E@(lF{6kU?~ir4%RUBmq4M4DD$wo7p-3@&f=Chi!@g diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.h b/MarsWater/AppDelegate.h similarity index 81% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.h rename to MarsWater/AppDelegate.h index 9db49ab..33642bf 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.h +++ b/MarsWater/AppDelegate.h @@ -1,9 +1,9 @@ // // AppDelegate.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m b/MarsWater/AppDelegate.m similarity index 91% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m rename to MarsWater/AppDelegate.m index 4e79a8f..8e592d7 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/AppDelegate.m +++ b/MarsWater/AppDelegate.m @@ -1,13 +1,11 @@ // // AppDelegate.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // -// These are our excellent Core Data methods that were automatically created when we set up the project!! - #import "AppDelegate.h" @interface AppDelegate () @@ -53,7 +51,7 @@ - (void)applicationWillTerminate:(UIApplication *)application { @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; - (NSURL *)applicationDocumentsDirectory { - // The directory the application uses to store the Core Data store file. This code uses a directory named "shenayoshida.CoreDataHomeworkPrep" in the application's documents directory. + // The directory the application uses to store the Core Data store file. This code uses a directory named "com.mikekavouras.MarsWater" in the application's documents directory. return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; } @@ -62,7 +60,7 @@ - (NSManagedObjectModel *)managedObjectModel { if (_managedObjectModel != nil) { return _managedObjectModel; } - NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"CoreDataHomeworkPrep" withExtension:@"momd"]; + NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MarsWater" withExtension:@"momd"]; _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; return _managedObjectModel; } @@ -76,7 +74,7 @@ - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { // Create the coordinator and store _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; - NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataHomeworkPrep.sqlite"]; + NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"MarsWater.sqlite"]; NSError *error = nil; NSString *failureReason = @"There was an error creating or loading the application's saved data."; if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Assets.xcassets/AppIcon.appiconset/Contents.json b/MarsWater/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Assets.xcassets/AppIcon.appiconset/Contents.json rename to MarsWater/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/LaunchScreen.storyboard b/MarsWater/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/LaunchScreen.storyboard rename to MarsWater/Base.lproj/LaunchScreen.storyboard diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard b/MarsWater/Base.lproj/Main.storyboard similarity index 55% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard rename to MarsWater/Base.lproj/Main.storyboard index ec7698b..3190779 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Base.lproj/Main.storyboard +++ b/MarsWater/Base.lproj/Main.storyboard @@ -1,287 +1,326 @@ - + - - + - - + + + - + - + + + + + + + - + - - + + - - - + + - + - - + - + - + - - + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + - + - + - + - + - - - - - + + + + + + + - + - + - - - - + - - - - - - - - + + + + + + + + + + + + + + + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - - + + + - + - + - + diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Info.plist b/MarsWater/Info.plist similarity index 100% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Info.plist rename to MarsWater/Info.plist diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h b/MarsWater/List+CoreDataProperties.h similarity index 81% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h rename to MarsWater/List+CoreDataProperties.h index 9611290..9ce8d06 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.h +++ b/MarsWater/List+CoreDataProperties.h @@ -1,9 +1,9 @@ // // List+CoreDataProperties.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu // to delete and recreate this implementation file for your updated model. diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m b/MarsWater/List+CoreDataProperties.m similarity index 73% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m rename to MarsWater/List+CoreDataProperties.m index 86d1772..6c70870 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List+CoreDataProperties.m +++ b/MarsWater/List+CoreDataProperties.m @@ -1,9 +1,9 @@ // // List+CoreDataProperties.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu // to delete and recreate this implementation file for your updated model. diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h b/MarsWater/List.h similarity index 69% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h rename to MarsWater/List.h index 8eaacc6..d7c69f2 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.h +++ b/MarsWater/List.h @@ -1,9 +1,9 @@ // // List.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m b/MarsWater/List.m similarity index 53% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m rename to MarsWater/List.m index 8382435..5edadfa 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/List.m +++ b/MarsWater/List.m @@ -1,9 +1,9 @@ // // List.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import "List.h" diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h b/MarsWater/ListCreationTableViewController.h similarity index 54% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h rename to MarsWater/ListCreationTableViewController.h index a80b1af..df226d4 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.h +++ b/MarsWater/ListCreationTableViewController.h @@ -1,9 +1,9 @@ // // ListCreationTableViewController.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m b/MarsWater/ListCreationTableViewController.m similarity index 59% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m rename to MarsWater/ListCreationTableViewController.m index 1bef821..e50b084 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListCreationTableViewController.m +++ b/MarsWater/ListCreationTableViewController.m @@ -1,15 +1,15 @@ // // ListCreationTableViewController.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import #import "ListCreationTableViewController.h" #import "List.h" -#import "AppDelegate.h" // now we can access the core data methods that are built in +#import "AppDelegate.h" @interface ListCreationTableViewController () @@ -20,53 +20,42 @@ @interface ListCreationTableViewController () @implementation ListCreationTableViewController -- (void)viewDidLoad -{ +- (void)viewDidLoad { [super viewDidLoad]; - [self setupNavigationBar]; // set up navigation controls programatically + [self setupNavigationBar]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; // create variable that has accesss to our delegate + AppDelegate *delegate = [UIApplication sharedApplication].delegate; - self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; // alloc init list object in core data + self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; - NSLog(@"%@", self.list); } -- (void)setupNavigationBar -{ - // set the title +- (void)setupNavigationBar { + self.navigationItem.title = @"Create New List"; - // set the left button to cancel self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; - // set the right button to save self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; } -- (void)cancel -{ +- (void)cancel { [self dismissViewControllerAnimated:YES completion:nil]; } -- (void)save -{ - self.list.title = self.titleTextField.text; // set title +- (void)save { + self.list.title = self.titleTextField.text; self.list.createdAt = [NSDate date]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + AppDelegate *delegate = [UIApplication sharedApplication].delegate; [delegate.managedObjectContext save:nil]; - [self dismissViewControllerAnimated:YES completion:nil]; // dismiss view controller - - // NSLog(@"%@", self.list); // test it + [self dismissViewControllerAnimated:YES completion:nil]; } -- (IBAction)colorButtonTapped:(UIButton *)sender -{ +- (IBAction)colorButtonTapped:(UIButton *)sender { self.list.color = sender.backgroundColor; } - @end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h b/MarsWater/ListsTableViewController.h similarity index 51% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h rename to MarsWater/ListsTableViewController.h index d6596e4..e83a1d1 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.h +++ b/MarsWater/ListsTableViewController.h @@ -1,9 +1,9 @@ // // ListsTableViewController.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m b/MarsWater/ListsTableViewController.m similarity index 70% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m rename to MarsWater/ListsTableViewController.m index fa3a6fa..9bf71f3 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ListsTableViewController.m +++ b/MarsWater/ListsTableViewController.m @@ -1,43 +1,42 @@ // // ListsTableViewController.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import #import "ListsTableViewController.h" #import "AppDelegate.h" #import "List.h" -#import "ItemsTableViewController.h" - +#import "TaskTableViewController.h" @interface ListsTableViewController () @property (nonatomic) NSFetchedResultsController *fetchedResultsController; -@property (nonatomic) NSString *listTitleForHeading; @end @implementation ListsTableViewController -- (void)viewDidLoad -{ +- (void)viewDidLoad { [super viewDidLoad]; + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // 1) create an instance of NSFetchRequest with an entity name NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"List"]; + // 2) create a sort descriptor NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"createdAt" ascending:NO]; // 3) set the sortDescriptors on the fetchRequest fetchRequest.sortDescriptors = @[sort]; - // 4)create a fetchResultsController with a fetchRequest and a managedObjectObjectContext + // 4) create a fetchedResultsController with a fetchRequest and a managedObjectContext, self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; self.fetchedResultsController.delegate = self; @@ -47,54 +46,50 @@ - (void)viewDidLoad [self.tableView reloadData]; } + #pragma mark - Table view data source -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.fetchedResultsController.fetchedObjects.count; } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"listCellIdentifier" forIndexPath:indexPath]; +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"ListCellIdentifier" forIndexPath:indexPath]; List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; - cell.textLabel.text = list.title; cell.backgroundColor = (UIColor *)list.color; + cell.textLabel.text = list.title; cell.detailTextLabel.text = [list.createdAt description]; return cell; } -- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath -{ +- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { + [self.tableView reloadData]; } #pragma mark - prepareForSegue -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showListName"]) { // create reference to segue title - NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; - List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; // grab dictionary of fetched items - ItemsTableViewController *detailController = segue.destinationViewController; + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; // for the selected row + List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; // grab dictionary of stored items + TaskTableViewController *detailController = segue.destinationViewController; // set destination viewController - NSLog(@"hello!!!! %@", list); - - // self.listTitleForHeading = list.title; - // NSLog(@"%@", self.listTitleForHeading); - - // detailController.listName = list.title; - // NSLog(@"%@", list.title); - // detailController.listColor = (UIColor *)list.color; + NSLog(@"%@", list); + detailController.listName = list.title; // pass title from list dictionary to new viewController + NSLog(@"%@", list.title); + detailController.listColor = (UIColor *)list.color; // pass color from list dictionary to new viewController } } + @end + diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion b/MarsWater/MarsWater.xcdatamodeld/.xccurrentversion similarity index 81% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion rename to MarsWater/MarsWater.xcdatamodeld/.xccurrentversion index b0ec248..5c0cbd5 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/.xccurrentversion +++ b/MarsWater/MarsWater.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - CoreDataHomeworkPrep.xcdatamodel + MarsWater.xcdatamodel diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents b/MarsWater/MarsWater.xcdatamodeld/MarsWater.xcdatamodel/contents similarity index 87% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents rename to MarsWater/MarsWater.xcdatamodeld/MarsWater.xcdatamodel/contents index 32500f3..116441d 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/CoreDataHomeworkPrep.xcdatamodeld/CoreDataHomeworkPrep.xcdatamodel/contents +++ b/MarsWater/MarsWater.xcdatamodeld/MarsWater.xcdatamodel/contents @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ - - + + \ No newline at end of file diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h b/MarsWater/Task+CoreDataProperties.h similarity index 85% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h rename to MarsWater/Task+CoreDataProperties.h index 98c43f2..2cc11d7 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.h +++ b/MarsWater/Task+CoreDataProperties.h @@ -1,9 +1,9 @@ // // Task+CoreDataProperties.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu // to delete and recreate this implementation file for your updated model. diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m b/MarsWater/Task+CoreDataProperties.m similarity index 77% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m rename to MarsWater/Task+CoreDataProperties.m index c914d05..1ea972c 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task+CoreDataProperties.m +++ b/MarsWater/Task+CoreDataProperties.m @@ -1,9 +1,9 @@ // // Task+CoreDataProperties.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // // Choose "Create NSManagedObject Subclass…" from the Core Data editor menu // to delete and recreate this implementation file for your updated model. diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h b/MarsWater/Task.h similarity index 70% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h rename to MarsWater/Task.h index 0fcd3c0..e714efc 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.h +++ b/MarsWater/Task.h @@ -1,9 +1,9 @@ // // Task.h -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m b/MarsWater/Task.m similarity index 55% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m rename to MarsWater/Task.m index 93f7648..c32ed42 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/Task.m +++ b/MarsWater/Task.m @@ -1,9 +1,9 @@ // // Task.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import "Task.h" diff --git a/MarsWater/TaskCreationTableViewController.h b/MarsWater/TaskCreationTableViewController.h new file mode 100644 index 0000000..f8fabbb --- /dev/null +++ b/MarsWater/TaskCreationTableViewController.h @@ -0,0 +1,13 @@ +// +// TaskCreationTableViewController.h +// MarsWater +// +// Created by Shena Yoshida on 10/6/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import + +@interface TaskCreationTableViewController : UITableViewController + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m b/MarsWater/TaskCreationTableViewController.m similarity index 56% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m rename to MarsWater/TaskCreationTableViewController.m index 37c1fbc..ed2738e 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemCreationTableViewController.m +++ b/MarsWater/TaskCreationTableViewController.m @@ -1,55 +1,86 @@ // -// ItemCreationTableViewController.m -// CoreDataHomeworkPrep +// TaskCreationTableViewController.m +// MarsWater // -// Created by Shena Yoshida on 10/5/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Shena Yoshida on 10/6/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // -#import "ItemCreationTableViewController.h" +#import "TaskCreationTableViewController.h" +#import +#import "Task.h" +#import "AppDelegate.h" // to access the cool built in core data methods -@interface ItemCreationTableViewController () +@interface TaskCreationTableViewController () + +@property (nonatomic) Task *task; +@property (weak, nonatomic) IBOutlet UITextField *taskTextField; @end -@implementation ItemCreationTableViewController +@implementation TaskCreationTableViewController - (void)viewDidLoad { [super viewDidLoad]; + [self setupNavigationBar]; + +} + +- (void)setupNavigationBar +{ + // set the title + self.navigationItem.title = @"Create To Do Item"; - // Uncomment the following line to preserve selection between presentations. - // self.clearsSelectionOnViewWillAppear = NO; + // set the left button to cancel + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; + // set the right button to save + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; + + NSLog(@"%@", self.taskTextField.text); +} + +- (void)cancel +{ + [self dismissViewControllerAnimated:YES completion:nil]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (void)save +{ + self.task.taskDescription = self.taskTextField.text; // set title + self.task.createdAt = [NSDate date]; + // self.task.priority = + // self.task.dueAt = + // self.task.completedAt = + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + [delegate.managedObjectContext save:nil]; + + [self dismissViewControllerAnimated:YES completion:nil]; + + NSLog(@"%@", self.task); // test it! } + #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { -#warning Incomplete implementation, return the number of sections - return 0; + return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -#warning Incomplete implementation, return the number of rows return 0; } -/* + - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskCreationIdentifier" forIndexPath:indexPath]; // Configure the cell... return cell; } -*/ + /* // Override to support conditional editing of the table view. diff --git a/MarsWater/TaskTableViewController.h b/MarsWater/TaskTableViewController.h new file mode 100644 index 0000000..dbba613 --- /dev/null +++ b/MarsWater/TaskTableViewController.h @@ -0,0 +1,20 @@ +// +// TaskTableViewController.h +// MarsWater +// +// Created by Shena Yoshida on 10/6/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import +#import "Task.h" +#import "ListsTableViewController.h" +#import "AppDelegate.h" + +@interface TaskTableViewController : UITableViewController + +@property (nonatomic) Task *task; +@property (nonatomic) NSString *listName; +@property (nonatomic) id listColor; + +@end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m b/MarsWater/TaskTableViewController.m similarity index 68% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m rename to MarsWater/TaskTableViewController.m index 2bd31a5..bb83aad 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/ItemsTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -1,65 +1,52 @@ // -// ItemsTableViewController.m -// CoreDataHomeworkPrep +// TaskTableViewController.m +// MarsWater // -// Created by Shena Yoshida on 10/5/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Shena Yoshida on 10/6/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // - -#import "ItemsTableViewController.h" -#import "ItemCreationTableViewController.h" +#import "TaskTableViewController.h" #import - - - - -@interface ItemsTableViewController () +@interface TaskTableViewController () @property (nonatomic) NSFetchedResultsController *fetchedResultsController; -//@property (nonatomic) NSArray *array; @end -@implementation ItemsTableViewController +@implementation TaskTableViewController -- (void)viewDidLoad -{ +- (void)viewDidLoad { [super viewDidLoad]; - - - - // NSLog(@"%@", self.listName); + [self setupNavigationBar]; + [self fetchResults]; + // [self.tableView reloadData]; - [self setupNavigationBar]; - [self fetchResults]; } -- (void)setupNavigationBar +-(void)setupNavigationBar { - // set the title - // self.navigationItem.title = self.listName; + self.navigationItem.title = self.listName; - // set the left button to cancel self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(createNewItem)]; + } - (void)cancel { - [self dismissViewControllerAnimated:YES completion:nil]; // dismiss when cancel button tapped + //[self dismissViewControllerAnimated:YES completion:nil]; } - (void)createNewItem { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; - UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"CreateItem"]; + UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"NavigationItem"]; [self presentViewController:navigationController animated:YES completion:nil]; - } - (void)fetchResults @@ -81,25 +68,21 @@ - (void)fetchResults #pragma mark - Table view data source -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"itemCellIdentifier" forIndexPath:indexPath]; + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"taskCellIdentifier" forIndexPath:indexPath]; // Configure the cell... return cell; } - @end diff --git a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m b/MarsWater/main.m similarity index 63% rename from CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m rename to MarsWater/main.m index 23be7c7..c107d8b 100644 --- a/CoreDataHomeworkPrep/CoreDataHomeworkPrep/main.m +++ b/MarsWater/main.m @@ -1,9 +1,9 @@ -// + // main.m -// CoreDataHomeworkPrep +// MarsWater // -// Created by Shena Yoshida on 10/4/15. -// Copyright © 2015 Shena Yoshida. All rights reserved. +// Created by Michael Kavouras on 10/4/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. // #import From 205ccf25a0e525cf3d4141ebd18291c25b74d5c7 Mon Sep 17 00:00:00 2001 From: shenayoshida Date: Wed, 7 Oct 2015 12:29:53 -0400 Subject: [PATCH 05/10] added mutable array --- .DS_Store | Bin 6148 -> 6148 bytes MarsWater/List+CoreDataProperties.h | 2 +- MarsWater/TaskTableViewController.m | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.DS_Store b/.DS_Store index 6c2c49cf78ef47141276208edbf0d899463798f7..3658a8b2608ccbe4c16151d73dede8ff764e2871 100644 GIT binary patch delta 68 zcmZoMXffE3%)~Tl&*b?`Iy^2eDWxUJ3=Eg71V2um%Vf@M#ry|I>+lz37zQWj=N2%4 U!GX<+%+FXRHt=s|=lIJH01`_U3;+NC delta 68 zcmZoMXffE3%*3>gdGdTF9Ud2#l+u!928K(PR}&`BWin@m&^r7D8HT~h`MCuQVDMnG RBJ(qri4FXl**X650{{TX74`rC diff --git a/MarsWater/List+CoreDataProperties.h b/MarsWater/List+CoreDataProperties.h index 9ce8d06..f440b89 100644 --- a/MarsWater/List+CoreDataProperties.h +++ b/MarsWater/List+CoreDataProperties.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, retain) NSString *title; @property (nullable, nonatomic, retain) NSDate *createdAt; @property (nullable, nonatomic, retain) id color; -@property (nullable, nonatomic, retain) NSArray *task; +@property (nullable, nonatomic, retain) NSOrderedSet *task; // this has been changed from NSArray @end diff --git a/MarsWater/TaskTableViewController.m b/MarsWater/TaskTableViewController.m index bb83aad..bd8348c 100644 --- a/MarsWater/TaskTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -39,7 +39,7 @@ -(void)setupNavigationBar - (void)cancel { - //[self dismissViewControllerAnimated:YES completion:nil]; + [self.navigationController popToRootViewControllerAnimated:YES]; } - (void)createNewItem From 3e1f09ea1bdbe544bb0cbaa644b90ab89d74d807 Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Wed, 7 Oct 2015 15:23:38 -0400 Subject: [PATCH 06/10] able to add items to lists --- .DS_Store | Bin 6148 -> 6148 bytes MarsWater.xcodeproj/project.pbxproj | 12 +- MarsWater/Base.lproj/Main.storyboard | 208 ++++++++++++++++---- MarsWater/List+CoreDataProperties.h | 2 +- MarsWater/TaskCreateViewController.h | 13 ++ MarsWater/TaskCreateViewController.m | 76 +++++++ MarsWater/TaskCreationTableViewController.h | 13 -- MarsWater/TaskCreationTableViewController.m | 129 ------------ MarsWater/TaskTableViewController.m | 15 +- 9 files changed, 276 insertions(+), 192 deletions(-) create mode 100644 MarsWater/TaskCreateViewController.h create mode 100644 MarsWater/TaskCreateViewController.m delete mode 100644 MarsWater/TaskCreationTableViewController.h delete mode 100644 MarsWater/TaskCreationTableViewController.m diff --git a/.DS_Store b/.DS_Store index 6c2c49cf78ef47141276208edbf0d899463798f7..3e6a49b0a6d3c5079082199766053b1c84b51446 100644 GIT binary patch delta 33 pcmZoMXffE3%*3?2bMky9oyilK8W=xpR%Cw0GO>YwGdss$egM_+3~B%X delta 33 pcmZoMXffE3%*3>gdGdTFoyilK8WYwGdss$egMZj3&#Ke diff --git a/MarsWater.xcodeproj/project.pbxproj b/MarsWater.xcodeproj/project.pbxproj index 2f62824..1c6bd57 100644 --- a/MarsWater.xcodeproj/project.pbxproj +++ b/MarsWater.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 4D53AEFC1BC441430084EFE8 /* TaskTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */; settings = {ASSET_TAGS = (); }; }; - 4D53AEFF1BC45C5F0084EFE8 /* TaskCreationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + 4D87C4C81BC58B73003367F3 /* TaskCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D87C4C71BC58B73003367F3 /* TaskCreateViewController.m */; settings = {ASSET_TAGS = (); }; }; 8DA86CA91BC1AE57006C50BC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CA81BC1AE57006C50BC /* main.m */; }; 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CAB1BC1AE57006C50BC /* AppDelegate.m */; }; 8DA86CB21BC1AE57006C50BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DA86CB01BC1AE57006C50BC /* Main.storyboard */; }; @@ -26,8 +26,8 @@ /* Begin PBXFileReference section */ 4D53AEFA1BC441430084EFE8 /* TaskTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskTableViewController.h; sourceTree = ""; }; 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskTableViewController.m; sourceTree = ""; }; - 4D53AEFD1BC45C5F0084EFE8 /* TaskCreationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskCreationTableViewController.h; sourceTree = ""; }; - 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskCreationTableViewController.m; sourceTree = ""; }; + 4D87C4C61BC58B73003367F3 /* TaskCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskCreateViewController.h; sourceTree = ""; }; + 4D87C4C71BC58B73003367F3 /* TaskCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskCreateViewController.m; sourceTree = ""; }; 8DA86CA41BC1AE57006C50BC /* MarsWater.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarsWater.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8DA86CA81BC1AE57006C50BC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8DA86CAA1BC1AE57006C50BC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -90,8 +90,8 @@ 8DA86CD61BC1B904006C50BC /* ListCreationTableViewController.m */, 4D53AEFA1BC441430084EFE8 /* TaskTableViewController.h */, 4D53AEFB1BC441430084EFE8 /* TaskTableViewController.m */, - 4D53AEFD1BC45C5F0084EFE8 /* TaskCreationTableViewController.h */, - 4D53AEFE1BC45C5F0084EFE8 /* TaskCreationTableViewController.m */, + 4D87C4C61BC58B73003367F3 /* TaskCreateViewController.h */, + 4D87C4C71BC58B73003367F3 /* TaskCreateViewController.m */, 8DA86CB01BC1AE57006C50BC /* Main.storyboard */, 8DA86CB61BC1AE57006C50BC /* Assets.xcassets */, 8DA86CB81BC1AE57006C50BC /* LaunchScreen.storyboard */, @@ -197,7 +197,7 @@ files = ( 8DA86CB51BC1AE57006C50BC /* MarsWater.xcdatamodeld in Sources */, 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */, - 4D53AEFF1BC45C5F0084EFE8 /* TaskCreationTableViewController.m in Sources */, + 4D87C4C81BC58B73003367F3 /* TaskCreateViewController.m in Sources */, 4D53AEFC1BC441430084EFE8 /* TaskTableViewController.m in Sources */, 8DB2F6EA1BC1E75500E58E65 /* Task+CoreDataProperties.m in Sources */, 8DA86CD41BC1B8E4006C50BC /* ListsTableViewController.m in Sources */, diff --git a/MarsWater/Base.lproj/Main.storyboard b/MarsWater/Base.lproj/Main.storyboard index 3190779..b847f91 100644 --- a/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/Base.lproj/Main.storyboard @@ -2,6 +2,8 @@ + + @@ -115,42 +117,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -160,13 +126,78 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -319,6 +350,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MarsWater/List+CoreDataProperties.h b/MarsWater/List+CoreDataProperties.h index 9ce8d06..66670ff 100644 --- a/MarsWater/List+CoreDataProperties.h +++ b/MarsWater/List+CoreDataProperties.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, retain) NSString *title; @property (nullable, nonatomic, retain) NSDate *createdAt; @property (nullable, nonatomic, retain) id color; -@property (nullable, nonatomic, retain) NSArray *task; +@property (nullable, nonatomic, retain) NSOrderedSet *task; // changed from NSArray @end diff --git a/MarsWater/TaskCreateViewController.h b/MarsWater/TaskCreateViewController.h new file mode 100644 index 0000000..79fe566 --- /dev/null +++ b/MarsWater/TaskCreateViewController.h @@ -0,0 +1,13 @@ +// +// TaskCreateViewController.h +// MarsWater +// +// Created by Shena Yoshida on 10/7/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import + +@interface TaskCreateViewController : UIViewController + +@end diff --git a/MarsWater/TaskCreateViewController.m b/MarsWater/TaskCreateViewController.m new file mode 100644 index 0000000..15db2fc --- /dev/null +++ b/MarsWater/TaskCreateViewController.m @@ -0,0 +1,76 @@ +// +// TaskCreateViewController.m +// MarsWater +// +// Created by Shena Yoshida on 10/7/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import "TaskCreateViewController.h" +#import +#import "Task.h" +#import "AppDelegate.h" // to access the cool built in core data methods + +@interface TaskCreateViewController () + +@property (nonatomic) Task *task; +@property (weak, nonatomic) IBOutlet UITextField *taskTextField; +@property (weak, nonatomic) IBOutlet UISlider *prioritySlider; +@property (nonatomic) NSNumber *priorityNumber; + +@end + +@implementation TaskCreateViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setupNavigationBar]; + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + + self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; + +} + +- (void)setupNavigationBar +{ + // set the title + self.navigationItem.title = @"Create To Do Item"; + + // set the left button to cancel + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; + + // set the right button to save + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; + + // NSLog(@"%@", self.taskTextField.text); +} + +- (void)cancel +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (IBAction)sliderValueChanged:(id)sender +{ + self.priorityNumber = [[NSNumber alloc]initWithFloat:self.prioritySlider.value]; +} + +- (void)save +{ + self.task.taskDescription = self.taskTextField.text; + self.task.createdAt = [NSDate date]; + self.task.priority = self.priorityNumber; + + // self.task.dueAt = + // self.task.completedAt = + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + [delegate.managedObjectContext save:nil]; + + [self dismissViewControllerAnimated:YES completion:nil]; + + NSLog(@"task: %@, created at: %@, priority: %@", self.task.taskDescription, self.task.createdAt, self.task.priority); // test it! +} + +@end diff --git a/MarsWater/TaskCreationTableViewController.h b/MarsWater/TaskCreationTableViewController.h deleted file mode 100644 index f8fabbb..0000000 --- a/MarsWater/TaskCreationTableViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// TaskCreationTableViewController.h -// MarsWater -// -// Created by Shena Yoshida on 10/6/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. -// - -#import - -@interface TaskCreationTableViewController : UITableViewController - -@end diff --git a/MarsWater/TaskCreationTableViewController.m b/MarsWater/TaskCreationTableViewController.m deleted file mode 100644 index ed2738e..0000000 --- a/MarsWater/TaskCreationTableViewController.m +++ /dev/null @@ -1,129 +0,0 @@ -// -// TaskCreationTableViewController.m -// MarsWater -// -// Created by Shena Yoshida on 10/6/15. -// Copyright © 2015 Michael Kavouras. All rights reserved. -// - -#import "TaskCreationTableViewController.h" -#import -#import "Task.h" -#import "AppDelegate.h" // to access the cool built in core data methods - -@interface TaskCreationTableViewController () - -@property (nonatomic) Task *task; -@property (weak, nonatomic) IBOutlet UITextField *taskTextField; - -@end - -@implementation TaskCreationTableViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setupNavigationBar]; - -} - -- (void)setupNavigationBar -{ - // set the title - self.navigationItem.title = @"Create To Do Item"; - - // set the left button to cancel - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; - - // set the right button to save - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; - - NSLog(@"%@", self.taskTextField.text); -} - -- (void)cancel -{ - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (void)save -{ - self.task.taskDescription = self.taskTextField.text; // set title - self.task.createdAt = [NSDate date]; - // self.task.priority = - // self.task.dueAt = - // self.task.completedAt = - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate - [delegate.managedObjectContext save:nil]; - - [self dismissViewControllerAnimated:YES completion:nil]; - - NSLog(@"%@", self.task); // test it! -} - - -#pragma mark - Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 0; -} - - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskCreationIdentifier" forIndexPath:indexPath]; - - // Configure the cell... - - return cell; -} - - -/* -// Override to support conditional editing of the table view. -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the specified item to be editable. - return YES; -} -*/ - -/* -// Override to support editing the table view. -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } -} -*/ - -/* -// Override to support rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { -} -*/ - -/* -// Override to support conditional rearranging of the table view. -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the item to be re-orderable. - return YES; -} -*/ - -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - -@end diff --git a/MarsWater/TaskTableViewController.m b/MarsWater/TaskTableViewController.m index bb83aad..6b12c39 100644 --- a/MarsWater/TaskTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -23,8 +23,6 @@ - (void)viewDidLoad { [self fetchResults]; // [self.tableView reloadData]; - - } -(void)setupNavigationBar @@ -34,12 +32,11 @@ -(void)setupNavigationBar self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(createNewItem)]; - } - (void)cancel { - //[self dismissViewControllerAnimated:YES completion:nil]; + [self.navigationController popToRootViewControllerAnimated:YES]; } - (void)createNewItem @@ -73,16 +70,22 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 0; + return self.fetchedResultsController.fetchedObjects.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"taskCellIdentifier" forIndexPath:indexPath]; - // Configure the cell... + Task *task = self.fetchedResultsController.fetchedObjects[indexPath.row]; + cell.textLabel.text = task.taskDescription; return cell; } +- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { // this method reloads table after item is added + + [self.tableView reloadData]; +} + @end From 11b83791315293fe38ecb09ab839db0f15dbf5c0 Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Wed, 7 Oct 2015 15:42:12 -0400 Subject: [PATCH 07/10] deleted merge conflict markers --- MarsWater/List+CoreDataProperties.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MarsWater/List+CoreDataProperties.h b/MarsWater/List+CoreDataProperties.h index c1f8d11..66670ff 100644 --- a/MarsWater/List+CoreDataProperties.h +++ b/MarsWater/List+CoreDataProperties.h @@ -18,11 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, retain) NSString *title; @property (nullable, nonatomic, retain) NSDate *createdAt; @property (nullable, nonatomic, retain) id color; -<<<<<<< HEAD @property (nullable, nonatomic, retain) NSOrderedSet *task; // changed from NSArray -======= -@property (nullable, nonatomic, retain) NSOrderedSet *task; // this has been changed from NSArray ->>>>>>> 205ccf25a0e525cf3d4141ebd18291c25b74d5c7 @end From 77928e8ebe266696ee642d03f97584528b2c33fe Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Wed, 7 Oct 2015 16:58:43 -0400 Subject: [PATCH 08/10] latest version --- MarsWater/Base.lproj/Main.storyboard | 2 +- MarsWater/ListCreationTableViewController.m | 2 ++ MarsWater/ListsTableViewController.m | 11 +++++++++++ MarsWater/TaskCreateViewController.m | 3 +++ MarsWater/TaskTableViewController.m | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/MarsWater/Base.lproj/Main.storyboard b/MarsWater/Base.lproj/Main.storyboard index b847f91..ba9cb2c 100644 --- a/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/Base.lproj/Main.storyboard @@ -86,7 +86,7 @@ - + diff --git a/MarsWater/ListCreationTableViewController.m b/MarsWater/ListCreationTableViewController.m index e50b084..8e281b5 100644 --- a/MarsWater/ListCreationTableViewController.m +++ b/MarsWater/ListCreationTableViewController.m @@ -45,6 +45,7 @@ - (void)cancel { } - (void)save { + self.list.title = self.titleTextField.text; self.list.createdAt = [NSDate date]; @@ -55,6 +56,7 @@ - (void)save { } - (IBAction)colorButtonTapped:(UIButton *)sender { + self.list.color = sender.backgroundColor; } diff --git a/MarsWater/ListsTableViewController.m b/MarsWater/ListsTableViewController.m index 9bf71f3..fe21e3b 100644 --- a/MarsWater/ListsTableViewController.m +++ b/MarsWater/ListsTableViewController.m @@ -91,5 +91,16 @@ -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender } } +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { // delete rows + +// [_objects removeObjectAtIndex:indexPath.row]; +// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; +// } else { +// NSLog(@"Unhandled editing style! %d", editingStyle); + + } +} + @end diff --git a/MarsWater/TaskCreateViewController.m b/MarsWater/TaskCreateViewController.m index 15db2fc..a028b52 100644 --- a/MarsWater/TaskCreateViewController.m +++ b/MarsWater/TaskCreateViewController.m @@ -58,6 +58,8 @@ - (IBAction)sliderValueChanged:(id)sender - (void)save { + if (self.taskTextField != nil) { // if there is text to save + self.task.taskDescription = self.taskTextField.text; self.task.createdAt = [NSDate date]; self.task.priority = self.priorityNumber; @@ -69,6 +71,7 @@ - (void)save [delegate.managedObjectContext save:nil]; [self dismissViewControllerAnimated:YES completion:nil]; + } NSLog(@"task: %@, created at: %@, priority: %@", self.task.taskDescription, self.task.createdAt, self.task.priority); // test it! } diff --git a/MarsWater/TaskTableViewController.m b/MarsWater/TaskTableViewController.m index 6b12c39..b026bc5 100644 --- a/MarsWater/TaskTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -50,7 +50,7 @@ - (void)fetchResults { AppDelegate *delegate = [UIApplication sharedApplication].delegate; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Task"]; - NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"createdAt" ascending:NO]; + NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"priority" ascending:NO]; fetchRequest.sortDescriptors = @[sort]; self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; From bb4c3c3005d7e30b71d4b6eaf48ca4a8daf668e4 Mon Sep 17 00:00:00 2001 From: shenayoshida Date: Wed, 7 Oct 2015 21:55:28 -0400 Subject: [PATCH 09/10] basic functionality is there, and you can delete list items --- .DS_Store | Bin 6148 -> 6148 bytes MarsWater/Base.lproj/Main.storyboard | 12 +++--- MarsWater/ListCreationTableViewController.m | 22 ++++++---- MarsWater/ListsTableViewController.m | 43 ++++++++++++++++---- MarsWater/Task+CoreDataProperties.h | 2 + MarsWater/Task+CoreDataProperties.m | 5 +++ MarsWater/TaskCreateViewController.h | 4 ++ MarsWater/TaskCreateViewController.m | 31 +++++++------- MarsWater/TaskTableViewController.h | 6 ++- MarsWater/TaskTableViewController.m | 12 +++++- 10 files changed, 95 insertions(+), 42 deletions(-) diff --git a/.DS_Store b/.DS_Store index 3e6a49b0a6d3c5079082199766053b1c84b51446..ac86b0eaf9751ac721811743c5de8e7dc0c8ee65 100644 GIT binary patch delta 67 zcmZoMXffE3%*3=`VDfw>9Ud2#l+u!928K)4;lh*WGMO_&XdS+S48!2${M-Tt5MbP_ Q$o!0DVuQeDc8 - + @@ -145,11 +145,6 @@ - - - - - diff --git a/MarsWater/ListCreationTableViewController.m b/MarsWater/ListCreationTableViewController.m index 8e281b5..2ee8e47 100644 --- a/MarsWater/ListCreationTableViewController.m +++ b/MarsWater/ListCreationTableViewController.m @@ -15,6 +15,7 @@ @interface ListCreationTableViewController () @property (weak, nonatomic) IBOutlet UITextField *titleTextField; @property (nonatomic) List *list; +@property (nonatomic) id color; @end @@ -24,11 +25,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self setupNavigationBar]; - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - - self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; - + } - (void)setupNavigationBar { @@ -46,18 +43,27 @@ - (void)cancel { - (void)save { + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + if (!self.list) { + self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; + } + self.list.title = self.titleTextField.text; self.list.createdAt = [NSDate date]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; + if (!self.color) { + self.list.color = [UIColor whiteColor]; + } else { + self.list.color = self.color; + } + [delegate.managedObjectContext save:nil]; [self dismissViewControllerAnimated:YES completion:nil]; } - (IBAction)colorButtonTapped:(UIButton *)sender { - - self.list.color = sender.backgroundColor; + self.color = sender.backgroundColor; } @end diff --git a/MarsWater/ListsTableViewController.m b/MarsWater/ListsTableViewController.m index fe21e3b..a4c468f 100644 --- a/MarsWater/ListsTableViewController.m +++ b/MarsWater/ListsTableViewController.m @@ -68,9 +68,32 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } +- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { + [self.tableView beginUpdates]; +} + - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { - - [self.tableView reloadData]; + + UITableView *tableView = self.tableView; + + switch (type) { + case NSFetchedResultsChangeDelete: + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] + withRowAnimation:UITableViewRowAnimationFade]; + break; + + case NSFetchedResultsChangeInsert: + [self.tableView insertRowsAtIndexPaths:@[newIndexPath] + withRowAnimation:UITableViewRowAnimationFade]; + break; + + default: + break; + } +} + +- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { + [self.tableView endUpdates]; } #pragma mark - prepareForSegue @@ -85,19 +108,21 @@ -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender NSLog(@"%@", list); - detailController.listName = list.title; // pass title from list dictionary to new viewController - NSLog(@"%@", list.title); - detailController.listColor = (UIColor *)list.color; // pass color from list dictionary to new viewController + detailController.list = list; + +// detailController.listName = list.title; // pass title from list dictionary to new viewController +// NSLog(@"%@", list.title); +// detailController.listColor = (UIColor *)list.color; // pass color from list dictionary to new viewController } } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // delete rows -// [_objects removeObjectAtIndex:indexPath.row]; -// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; -// } else { -// NSLog(@"Unhandled editing style! %d", editingStyle); + List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; // grab dictionary of stored items + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + [delegate.managedObjectContext deleteObject:list]; + [delegate.managedObjectContext save:nil]; } } diff --git a/MarsWater/Task+CoreDataProperties.h b/MarsWater/Task+CoreDataProperties.h index 2cc11d7..859c701 100644 --- a/MarsWater/Task+CoreDataProperties.h +++ b/MarsWater/Task+CoreDataProperties.h @@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, retain) NSDate *completedAt; @property (nullable, nonatomic, retain) List *list; +// @property (nonatomic, readonly, getter=isEmpty) BOOL empty; + @end NS_ASSUME_NONNULL_END diff --git a/MarsWater/Task+CoreDataProperties.m b/MarsWater/Task+CoreDataProperties.m index 1ea972c..5d11482 100644 --- a/MarsWater/Task+CoreDataProperties.m +++ b/MarsWater/Task+CoreDataProperties.m @@ -21,4 +21,9 @@ @implementation Task (CoreDataProperties) @dynamic completedAt; @dynamic list; +//- (BOOL)isEmpty +//{ +// return [self.taskDescription stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0; +//} + @end diff --git a/MarsWater/TaskCreateViewController.h b/MarsWater/TaskCreateViewController.h index 79fe566..0549f1d 100644 --- a/MarsWater/TaskCreateViewController.h +++ b/MarsWater/TaskCreateViewController.h @@ -8,6 +8,10 @@ #import +@class List; // let this view controller know that List is a valid class + @interface TaskCreateViewController : UIViewController +@property (nonatomic) List *list; + @end diff --git a/MarsWater/TaskCreateViewController.m b/MarsWater/TaskCreateViewController.m index a028b52..48b4131 100644 --- a/MarsWater/TaskCreateViewController.m +++ b/MarsWater/TaskCreateViewController.m @@ -10,6 +10,7 @@ #import #import "Task.h" #import "AppDelegate.h" // to access the cool built in core data methods +#import "List.h" @interface TaskCreateViewController () @@ -29,7 +30,6 @@ - (void)viewDidLoad { AppDelegate *delegate = [UIApplication sharedApplication].delegate; self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; - } - (void)setupNavigationBar @@ -58,22 +58,23 @@ - (IBAction)sliderValueChanged:(id)sender - (void)save { - if (self.taskTextField != nil) { // if there is text to save + if (self.taskTextField.text.length != 0) { // if there is text to save - self.task.taskDescription = self.taskTextField.text; - self.task.createdAt = [NSDate date]; - self.task.priority = self.priorityNumber; - - // self.task.dueAt = - // self.task.completedAt = - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate - [delegate.managedObjectContext save:nil]; - - [self dismissViewControllerAnimated:YES completion:nil]; - } + self.task.taskDescription = self.taskTextField.text; + self.task.createdAt = [NSDate date]; + self.task.priority = self.priorityNumber; + self.task.list = self.list; + + // self.task.dueAt = + // self.task.completedAt = + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + [delegate.managedObjectContext save:nil]; + + [self dismissViewControllerAnimated:YES completion:nil]; + } - NSLog(@"task: %@, created at: %@, priority: %@", self.task.taskDescription, self.task.createdAt, self.task.priority); // test it! + NSLog(@"task: %@, created at: %@, priority: %@", self.task.taskDescription, self.task.createdAt, self.task.priority); // test it! } @end diff --git a/MarsWater/TaskTableViewController.h b/MarsWater/TaskTableViewController.h index dbba613..3cce759 100644 --- a/MarsWater/TaskTableViewController.h +++ b/MarsWater/TaskTableViewController.h @@ -10,11 +10,13 @@ #import "Task.h" #import "ListsTableViewController.h" #import "AppDelegate.h" +#import "List.h" @interface TaskTableViewController : UITableViewController @property (nonatomic) Task *task; -@property (nonatomic) NSString *listName; -@property (nonatomic) id listColor; +@property (nonatomic) List *list; +//@property (nonatomic) NSString *listName; +//@property (nonatomic) id listColor; @end diff --git a/MarsWater/TaskTableViewController.m b/MarsWater/TaskTableViewController.m index b026bc5..c554efd 100644 --- a/MarsWater/TaskTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -8,6 +8,7 @@ #import "TaskTableViewController.h" #import +#import "TaskCreateViewController.h" @interface TaskTableViewController () @@ -27,7 +28,7 @@ - (void)viewDidLoad { -(void)setupNavigationBar { - self.navigationItem.title = self.listName; + self.navigationItem.title = self.list.title; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; @@ -42,7 +43,13 @@ - (void)cancel - (void)createNewItem { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; - UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"NavigationItem"]; + + TaskCreateViewController *createVC = [storyboard instantiateViewControllerWithIdentifier:@"TaskCreateIdentifier"]; + createVC.list = self.list; + +// UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"NavigationItem"]; + + UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:createVC]; [self presentViewController:navigationController animated:YES completion:nil]; } @@ -52,6 +59,7 @@ - (void)fetchResults NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Task"]; NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"priority" ascending:NO]; fetchRequest.sortDescriptors = @[sort]; + fetchRequest.predicate = [NSPredicate predicateWithFormat:@"list.title == %@", self.list.title]; self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; From 7aa39afcc38cf5deb8d148bbf68296099884d596 Mon Sep 17 00:00:00 2001 From: Shena Yoshida Date: Thu, 8 Oct 2015 14:36:09 -0400 Subject: [PATCH 10/10] added more notes and adjusted spacing --- .DS_Store | Bin 6148 -> 6148 bytes MarsWater/ListCreationTableViewController.m | 20 ++++---- MarsWater/ListsTableViewController.m | 35 +++++++------- MarsWater/TaskCreateViewController.m | 10 ++-- MarsWater/TaskTableViewController.h | 2 - MarsWater/TaskTableViewController.m | 48 ++++++++++++-------- 6 files changed, 63 insertions(+), 52 deletions(-) diff --git a/.DS_Store b/.DS_Store index ac86b0eaf9751ac721811743c5de8e7dc0c8ee65..cc92c662dffecfbdb3bf323c4b40816df74ae972 100644 GIT binary patch delta 64 zcmZoMXffE3%*6Ek%H;V>Iy^2eDWxUJ3=Eg7S*s?`WwKxbQ#$+w8HT~h`MCuQAi!v_ OS&;cF%Vu_tzx)8Kyc3N8 delta 66 zcmZoMXffE3%*3=`VDfw>9Ud2#l+u!928K)4;lh*WGFdQzDILCo48!2${M-Tt5MbP_ Q$o!0DVuQeDc8 @implementation ListsTableViewController -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; - AppDelegate *delegate = [UIApplication sharedApplication].delegate; // 1) create an instance of NSFetchRequest with an entity name NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"List"]; - // 2) create a sort descriptor NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"createdAt" ascending:NO]; @@ -49,15 +48,18 @@ - (void)viewDidLoad { #pragma mark - Table view data source -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ return 1; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ return self.fetchedResultsController.fetchedObjects.count; } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"ListCellIdentifier" forIndexPath:indexPath]; List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; @@ -68,11 +70,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } -- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { +- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller +{ [self.tableView beginUpdates]; } -- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { +- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath +{ UITableView *tableView = self.tableView; @@ -92,8 +96,9 @@ - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id) } } -- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { - [self.tableView endUpdates]; +- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller +{ + [self.tableView endUpdates]; } #pragma mark - prepareForSegue @@ -108,22 +113,18 @@ -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender NSLog(@"%@", list); - detailController.list = list; - -// detailController.listName = list.title; // pass title from list dictionary to new viewController -// NSLog(@"%@", list.title); -// detailController.listColor = (UIColor *)list.color; // pass color from list dictionary to new viewController + detailController.list = list; // pass list name for navigation bar title } } -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ if (editingStyle == UITableViewCellEditingStyleDelete) { // delete rows List *list = self.fetchedResultsController.fetchedObjects[indexPath.row]; // grab dictionary of stored items AppDelegate *delegate = [UIApplication sharedApplication].delegate; [delegate.managedObjectContext deleteObject:list]; [delegate.managedObjectContext save:nil]; - } } diff --git a/MarsWater/TaskCreateViewController.m b/MarsWater/TaskCreateViewController.m index 48b4131..2a61569 100644 --- a/MarsWater/TaskCreateViewController.m +++ b/MarsWater/TaskCreateViewController.m @@ -23,7 +23,8 @@ @interface TaskCreateViewController () @implementation TaskCreateViewController -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; [self setupNavigationBar]; @@ -43,7 +44,7 @@ - (void)setupNavigationBar // set the right button to save self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; - // NSLog(@"%@", self.taskTextField.text); + // NSLog(@"%@", self.taskTextField.text); // test it! } - (void)cancel @@ -53,7 +54,7 @@ - (void)cancel - (IBAction)sliderValueChanged:(id)sender { - self.priorityNumber = [[NSNumber alloc]initWithFloat:self.prioritySlider.value]; + self.priorityNumber = [[NSNumber alloc]initWithFloat:self.prioritySlider.value]; // set slider value to storage number } - (void)save @@ -69,9 +70,10 @@ - (void)save // self.task.completedAt = AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate + [delegate.managedObjectContext save:nil]; - [self dismissViewControllerAnimated:YES completion:nil]; + [self dismissViewControllerAnimated:YES completion:nil]; // dismiss viewController and return to TaskTableView } NSLog(@"task: %@, created at: %@, priority: %@", self.task.taskDescription, self.task.createdAt, self.task.priority); // test it! diff --git a/MarsWater/TaskTableViewController.h b/MarsWater/TaskTableViewController.h index 3cce759..d8abd91 100644 --- a/MarsWater/TaskTableViewController.h +++ b/MarsWater/TaskTableViewController.h @@ -16,7 +16,5 @@ @property (nonatomic) Task *task; @property (nonatomic) List *list; -//@property (nonatomic) NSString *listName; -//@property (nonatomic) id listColor; @end diff --git a/MarsWater/TaskTableViewController.m b/MarsWater/TaskTableViewController.m index c554efd..f17a4f3 100644 --- a/MarsWater/TaskTableViewController.m +++ b/MarsWater/TaskTableViewController.m @@ -18,12 +18,11 @@ @interface TaskTableViewController () @implementation TaskTableViewController -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; [self setupNavigationBar]; [self fetchResults]; - // [self.tableView reloadData]; - } -(void)setupNavigationBar @@ -47,52 +46,61 @@ - (void)createNewItem TaskCreateViewController *createVC = [storyboard instantiateViewControllerWithIdentifier:@"TaskCreateIdentifier"]; createVC.list = self.list; -// UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"NavigationItem"]; + // Here's another way to add a UINavigationController: + // UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"NavigationItem"]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:createVC]; + [self presentViewController:navigationController animated:YES completion:nil]; } - (void)fetchResults { - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Task"]; - NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"priority" ascending:NO]; - fetchRequest.sortDescriptors = @[sort]; - fetchRequest.predicate = [NSPredicate predicateWithFormat:@"list.title == %@", self.list.title]; + AppDelegate *delegate = [UIApplication sharedApplication].delegate; // set delegate - self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; + NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Task"]; // create fetch request instance for tasks - self.fetchedResultsController.delegate = self; + NSSortDescriptor *sort = [[NSSortDescriptor alloc]initWithKey:@"priority" ascending:NO]; //create sort descriptor, sort by priority - [self.fetchedResultsController performFetch:nil]; + fetchRequest.sortDescriptors = @[sort]; // have fetched items organized by sort descriptor - [self.tableView reloadData]; + fetchRequest.predicate = [NSPredicate predicateWithFormat:@"list.title == %@", self.list.title]; // set task predicate to individual list + + self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:delegate.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; // create fetch request controller and set to our fetchRequest (tasks) + + self.fetchedResultsController.delegate = self; // set delegate for fetchRequestController + + [self.fetchedResultsController performFetch:nil]; // perform fetch + + [self.tableView reloadData]; // reload table view } #pragma mark - Table view data source -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ return 1; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.fetchedResultsController.fetchedObjects.count; +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.fetchedResultsController.fetchedObjects.count; // number of fetched items in memory } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"taskCellIdentifier" forIndexPath:indexPath]; Task *task = self.fetchedResultsController.fetchedObjects[indexPath.row]; - cell.textLabel.text = task.taskDescription; + cell.textLabel.text = task.taskDescription; return cell; } -- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { // this method reloads table after item is added - +- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath // this method reloads table after item is added +{ [self.tableView reloadData]; }