Commits

Allan Davis committed 2102c70

Updated Presentation and app

  • Participants
  • Parent commits 5552d8a

Comments (0)

Files changed (12)

code/TaskList/TaskList.xcodeproj/project.pbxproj

 	objects = {
 
 /* Begin PBXBuildFile section */
+		CE2C761B1642E995006060C7 /* Category.m in Sources */ = {isa = PBXBuildFile; fileRef = CE2C761A1642E995006060C7 /* Category.m */; };
+		CE2C761F1642E995006060C7 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = CE2C761E1642E995006060C7 /* Task.m */; };
 		CE4C631F163DA0CE00413733 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4C631E163DA0CE00413733 /* UIKit.framework */; };
 		CE4C6321163DA0CE00413733 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4C6320163DA0CE00413733 /* Foundation.framework */; };
 		CE4C6323163DA0CE00413733 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4C6322163DA0CE00413733 /* CoreGraphics.framework */; };
 		CE4C634D163DA0CF00413733 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE4C634B163DA0CF00413733 /* InfoPlist.strings */; };
 		CE4C6362163DA28F00413733 /* MathSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C6361163DA28F00413733 /* MathSpec.m */; };
 		CE4C6374163DA55A00413733 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE4C6372163DA55A00413733 /* Main.storyboard */; };
-		CE4C6377163F8D1D00413733 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C6376163F8D1D00413733 /* Task.m */; };
-		CE4C6378163F8D1D00413733 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C6376163F8D1D00413733 /* Task.m */; };
 		CE4C637B163F922D00413733 /* CCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C637A163F922D00413733 /* CCViewController.m */; };
 		CE4C637C163F922D00413733 /* CCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C637A163F922D00413733 /* CCViewController.m */; };
 		CE4C63EA1642321E00413733 /* Task+CRUD.m in Sources */ = {isa = PBXBuildFile; fileRef = CE4C63E91642321E00413733 /* Task+CRUD.m */; };
 
 /* Begin PBXFileReference section */
 		CA2BC4B40E3C4AC5ACA25B19 /* Pods-tests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tests.xcconfig"; path = "Pods/Pods-tests.xcconfig"; sourceTree = SOURCE_ROOT; };
+		CE2C76191642E995006060C7 /* Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Category.h; sourceTree = "<group>"; };
+		CE2C761A1642E995006060C7 /* Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Category.m; sourceTree = "<group>"; };
+		CE2C761D1642E995006060C7 /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Task.h; sourceTree = "<group>"; };
+		CE2C761E1642E995006060C7 /* Task.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Task.m; sourceTree = "<group>"; };
 		CE4C631A163DA0CE00413733 /* TaskList.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TaskList.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		CE4C631E163DA0CE00413733 /* UIKit.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
 		CE4C6320163DA0CE00413733 /* Foundation.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
 		CE4C634C163DA0CF00413733 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		CE4C6361163DA28F00413733 /* MathSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MathSpec.m; sourceTree = "<group>"; };
 		CE4C6373163DA55A00413733 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = TaskList/en.lproj/Main.storyboard; sourceTree = "<group>"; };
-		CE4C6375163F8D1D00413733 /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Task.h; path = models/Task.h; sourceTree = "<group>"; };
-		CE4C6376163F8D1D00413733 /* Task.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Task.m; path = models/Task.m; sourceTree = "<group>"; };
 		CE4C6379163F922D00413733 /* CCViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCViewController.h; sourceTree = "<group>"; };
 		CE4C637A163F922D00413733 /* CCViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCViewController.m; sourceTree = "<group>"; };
 		CE4C63E81642321E00413733 /* Task+CRUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Task+CRUD.h"; sourceTree = "<group>"; };
 				CE4C632F163DA0CE00413733 /* CCAppDelegate.h */,
 				CE4C6330163DA0CE00413733 /* CCAppDelegate.m */,
 				CE4C6338163DA0CE00413733 /* TaskList.xcdatamodeld */,
-				CE4C6375163F8D1D00413733 /* Task.h */,
-				CE4C6376163F8D1D00413733 /* Task.m */,
+				CE2C761D1642E995006060C7 /* Task.h */,
+				CE2C761E1642E995006060C7 /* Task.m */,
+				CE2C76191642E995006060C7 /* Category.h */,
+				CE2C761A1642E995006060C7 /* Category.m */,
 				CE4C6327163DA0CE00413733 /* Supporting Files */,
 				CE4C6379163F922D00413733 /* CCViewController.h */,
 				CE4C637A163F922D00413733 /* CCViewController.m */,
 				CE4C632D163DA0CE00413733 /* main.m in Sources */,
 				CE4C6331163DA0CE00413733 /* CCAppDelegate.m in Sources */,
 				CE4C633A163DA0CE00413733 /* TaskList.xcdatamodeld in Sources */,
-				CE4C6377163F8D1D00413733 /* Task.m in Sources */,
 				CE4C637B163F922D00413733 /* CCViewController.m in Sources */,
 				CE4C63EA1642321E00413733 /* Task+CRUD.m in Sources */,
+				CE2C761B1642E995006060C7 /* Category.m in Sources */,
+				CE2C761F1642E995006060C7 /* Task.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 			buildActionMask = 2147483647;
 			files = (
 				CE4C6362163DA28F00413733 /* MathSpec.m in Sources */,
-				CE4C6378163F8D1D00413733 /* Task.m in Sources */,
 				CE4C637C163F922D00413733 /* CCViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

code/TaskList/TaskList/CCAppDelegate.m

 //
 
 #import "CCAppDelegate.h"
-#import "Task.h"
+#import "Task+CRUD.h"
 
 @implementation CCAppDelegate
 
 //    NSArray *testTasks = @[@"Task 1", @"Task 2"];
 //    NSManagedObjectContext *context = [self managedObjectContext];
 //    for(NSString *taskName in testTasks){
-//        NSError *error = nil;
-//        Task * task = [NSEntityDescription
-//                       insertNewObjectForEntityForName:@"Task"
-//                       inManagedObjectContext:context];
-//        task.name = taskName;
-//        [context save:&error];
+//        [Task taskWithName:taskName fromContext:context];
 //    }
     
     

code/TaskList/TaskList/CCViewController.m

     // 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;
+    //self.navigationItem.rightBarButtonItem = self.editButtonItem;
     self.tasks = [Task allTaskFromContext: self.managedObjectContext];
     [self.tableView reloadData];
 }

code/TaskList/TaskList/Category.h

+//
+//  Category.h
+//  TaskList
+//
+//  Created by Allan Davis on 11/1/12.
+//  Copyright (c) 2012 Cajun Code. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreData/CoreData.h>
+
+@class Task;
+
+@interface Category : NSManagedObject
+
+@property (nonatomic, retain) NSString * name;
+@property (nonatomic, retain) NSSet *tasks;
+@end
+
+@interface Category (CoreDataGeneratedAccessors)
+
+- (void)addTasksObject:(Task *)value;
+- (void)removeTasksObject:(Task *)value;
+- (void)addTasks:(NSSet *)values;
+- (void)removeTasks:(NSSet *)values;
+
+@end

code/TaskList/TaskList/Category.m

+//
+//  Category.m
+//  TaskList
+//
+//  Created by Allan Davis on 11/1/12.
+//  Copyright (c) 2012 Cajun Code. All rights reserved.
+//
+
+#import "Category.h"
+#import "Task.h"
+
+
+@implementation Category
+
+@dynamic name;
+@dynamic tasks;
+
+@end

code/TaskList/TaskList/Task+CRUD.m

     NSEntityDescription *entity = [NSEntityDescription
                                    entityForName:@"Task" inManagedObjectContext:context];
     [fetchRequest setEntity:entity];
+//    fetchRequest.predicate = [NSPredicate predicateWithFormat:@"category.name = %@", category.name];
+//    fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
     return fetchRequest;
 }
 + (NSArray *) allTaskFromContext:(NSManagedObjectContext *)context{
     
 }
 + (Task *) taskWithName:(NSString*)name fromContext:(NSManagedObjectContext *)context{
-    Task *task = [NSEntityDescription insertNewObjectForEntityForName:@"Trim" inManagedObjectContext:context];
+    Task *task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:context];
     task.name = name;
     NSError *error = nil;
     [context save:&error];

code/TaskList/TaskList/Task.h

+//
+//  Task.h
+//  TaskList
+//
+//  Created by Allan Davis on 11/1/12.
+//  Copyright (c) 2012 Cajun Code. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreData/CoreData.h>
+
+@class Category;
+
+@interface Task : NSManagedObject
+
+@property (nonatomic, retain) NSNumber * done;
+@property (nonatomic, retain) NSString * name;
+@property (nonatomic, retain) Category *category;
+
+@end

code/TaskList/TaskList/Task.m

+//
+//  Task.m
+//  TaskList
+//
+//  Created by Allan Davis on 11/1/12.
+//  Copyright (c) 2012 Cajun Code. All rights reserved.
+//
+
+#import "Task.h"
+#import "Category.h"
+
+
+@implementation Task
+
+@dynamic done;
+@dynamic name;
+@dynamic category;
+
+@end

code/TaskList/TaskList/TaskList.xcdatamodeld/TaskList.xcdatamodel/contents

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1810" systemVersion="11G63" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
+<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1811" systemVersion="11G63b" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
+    <entity name="Category" representedClassName="Category" syncable="YES">
+        <attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
+        <relationship name="tasks" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Task" inverseName="category" inverseEntity="Task" syncable="YES"/>
+    </entity>
     <entity name="Task" representedClassName="Task" syncable="YES">
         <attribute name="done" optional="YES" attributeType="Boolean" syncable="YES"/>
         <attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
+        <relationship name="category" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="Category" inverseName="tasks" inverseEntity="Category" syncable="YES"/>
     </entity>
     <elements>
-        <element name="Task" positionX="160" positionY="192" width="128" height="75"/>
+        <element name="Task" positionX="27" positionY="189" width="128" height="90"/>
+        <element name="Category" positionX="196" positionY="192" width="128" height="75"/>
     </elements>
 </model>

code/TaskList/TaskList/models/Task.h

-//
-//  Task.h
-//  TaskList
-//
-//  Created by Allan Davis on 10/30/12.
-//  Copyright (c) 2012 Cajun Code. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <CoreData/CoreData.h>
-
-
-@interface Task : NSManagedObject
-
-@property (nonatomic, retain) NSString * name;
-@property (nonatomic, retain) NSNumber * done;
-
-@end

code/TaskList/TaskList/models/Task.m

-//
-//  Task.m
-//  TaskList
-//
-//  Created by Allan Davis on 10/30/12.
-//  Copyright (c) 2012 Cajun Code. All rights reserved.
-//
-
-#import "Task.h"
-
-
-@implementation Task
-
-@dynamic name;
-@dynamic done;
-
-@end

presentations/task_list.odp

Binary file modified.