diff --git a/the-blue-alliance-ios/Event.h b/Event.h similarity index 80% rename from the-blue-alliance-ios/Event.h rename to Event.h index cf5e8b5c0..dc98c810f 100644 --- a/the-blue-alliance-ios/Event.h +++ b/Event.h @@ -1,14 +1,15 @@ // // Event.h -// The Blue Alliance +// the-blue-alliance-ios // -// Created by Donald Pinckney on 5/5/14. +// Created by Donald Pinckney on 5/22/14. // Copyright (c) 2014 The Blue Alliance. All rights reserved. // #import #import +@class Team; @interface Event : NSManagedObject @@ -23,24 +24,33 @@ typedef enum EventType : NSInteger { UNLABLED = -1 } EventType; +@property (nonatomic, retain) NSString * address; +@property (nonatomic, retain) NSNumber * district_enum; +@property (nonatomic, retain) NSDate * end_date; +@property (nonatomic, retain) NSString * event_short; +@property (nonatomic, retain) NSNumber * event_type; @property (nonatomic, retain) NSString * key; +@property (nonatomic, retain) NSNumber * last_updated; +@property (nonatomic, retain) NSString * location; @property (nonatomic, retain) NSString * name; -@property (nonatomic, retain) NSNumber * event_type; +@property (nonatomic, retain) NSNumber * official; @property (nonatomic, retain) NSString * short_name; -@property (nonatomic, retain) NSString * event_short; -@property (nonatomic, retain) NSNumber * year; -@property (nonatomic, retain) NSNumber * district_enum; @property (nonatomic, retain) NSDate * start_date; -@property (nonatomic, retain) NSDate * end_date; -@property (nonatomic, retain) NSString * venue; -@property (nonatomic, retain) NSString * address; -@property (nonatomic, retain) NSString * location; +@property (nonatomic, retain) NSString * stats; @property (nonatomic, retain) NSString * timezone; -@property (nonatomic, retain) NSNumber * official; -@property (nonatomic, retain) NSString * website; +@property (nonatomic, retain) NSString * venue; @property (nonatomic, retain) NSString * webcasts; -@property (nonatomic, retain) NSString * stats; +@property (nonatomic, retain) NSString * website; +@property (nonatomic, retain) NSNumber * year; @property (nonatomic, retain) NSString * rankings; -@property (nonatomic, retain) NSNumber * last_updated; +@property (nonatomic, retain) NSSet *teams; +@end + +@interface Event (CoreDataGeneratedAccessors) + +- (void)addTeamsObject:(Team *)value; +- (void)removeTeamsObject:(Team *)value; +- (void)addTeams:(NSSet *)values; +- (void)removeTeams:(NSSet *)values; @end diff --git a/the-blue-alliance-ios/Event.m b/Event.m similarity index 82% rename from the-blue-alliance-ios/Event.m rename to Event.m index daf919f6d..a565e4442 100644 --- a/the-blue-alliance-ios/Event.m +++ b/Event.m @@ -1,34 +1,36 @@ // // Event.m -// The Blue Alliance +// the-blue-alliance-ios // -// Created by Donald Pinckney on 5/5/14. +// Created by Donald Pinckney on 5/22/14. // Copyright (c) 2014 The Blue Alliance. All rights reserved. // #import "Event.h" +#import "Team.h" @implementation Event +@dynamic address; +@dynamic district_enum; +@dynamic end_date; +@dynamic event_short; +@dynamic event_type; @dynamic key; +@dynamic last_updated; +@dynamic location; @dynamic name; -@dynamic event_type; +@dynamic official; @dynamic short_name; -@dynamic event_short; -@dynamic year; -@dynamic district_enum; @dynamic start_date; -@dynamic end_date; -@dynamic venue; -@dynamic address; -@dynamic location; +@dynamic stats; @dynamic timezone; -@dynamic official; -@dynamic website; +@dynamic venue; @dynamic webcasts; -@dynamic stats; +@dynamic website; +@dynamic year; @dynamic rankings; -@dynamic last_updated; +@dynamic teams; @end diff --git a/the-blue-alliance-ios.xcodeproj/project.pbxproj b/the-blue-alliance-ios.xcodeproj/project.pbxproj index 27ea10643..2f2b250cf 100644 --- a/the-blue-alliance-ios.xcodeproj/project.pbxproj +++ b/the-blue-alliance-ios.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ 394BD129CFDF44B78FFF2C94 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DDCC6CCFB1A4A199C72C12E /* libPods.a */; }; 5057CD1E1929987D00654304 /* SearchableCoreDataTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5057CD1D1929987D00654304 /* SearchableCoreDataTableViewController.m */; }; + 5070EE69192E95FA0079D123 /* Team.m in Sources */ = {isa = PBXBuildFile; fileRef = 5070EE68192E95FA0079D123 /* Team.m */; }; + 5070EE6C192E965C0079D123 /* Event.m in Sources */ = {isa = PBXBuildFile; fileRef = 5070EE6B192E965C0079D123 /* Event.m */; }; 50832DFB1918BB63003AC8A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50832DFA1918BB63003AC8A7 /* Foundation.framework */; }; 50832DFD1918BB63003AC8A7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50832DFC1918BB63003AC8A7 /* CoreGraphics.framework */; }; 50832DFF1918BB63003AC8A7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50832DFE1918BB63003AC8A7 /* UIKit.framework */; }; @@ -24,7 +26,6 @@ 50832E271918BB63003AC8A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 50832E251918BB63003AC8A7 /* InfoPlist.strings */; }; 50832E291918BB63003AC8A7 /* the_blue_alliance_iosTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 50832E281918BB63003AC8A7 /* the_blue_alliance_iosTests.m */; }; 50832E341918BB8E003AC8A7 /* The Blue Alliance.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 50832E321918BB8E003AC8A7 /* The Blue Alliance.xcdatamodeld */; }; - 50832E391918BBBE003AC8A7 /* Event.m in Sources */ = {isa = PBXBuildFile; fileRef = 50832E361918BBBE003AC8A7 /* Event.m */; }; 50832E3A1918BBBE003AC8A7 /* Event+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 50832E381918BBBE003AC8A7 /* Event+Create.m */; }; 50832E3E1918BBEA003AC8A7 /* EventsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50832E3D1918BBEA003AC8A7 /* EventsViewController.m */; }; 50832E551918BBFF003AC8A7 /* CoreDataTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50832E541918BBFF003AC8A7 /* CoreDataTableViewController.m */; }; @@ -54,6 +55,10 @@ 4DDCC6CCFB1A4A199C72C12E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 5057CD1C1929987D00654304 /* SearchableCoreDataTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchableCoreDataTableViewController.h; sourceTree = ""; }; 5057CD1D1929987D00654304 /* SearchableCoreDataTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchableCoreDataTableViewController.m; sourceTree = ""; }; + 5070EE67192E95FA0079D123 /* Team.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Team.h; sourceTree = ""; }; + 5070EE68192E95FA0079D123 /* Team.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Team.m; sourceTree = ""; }; + 5070EE6A192E965C0079D123 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = ../Event.h; sourceTree = ""; }; + 5070EE6B192E965C0079D123 /* Event.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Event.m; path = ../Event.m; sourceTree = ""; }; 50832DF71918BB63003AC8A7 /* the-blue-alliance-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "the-blue-alliance-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 50832DFA1918BB63003AC8A7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 50832DFC1918BB63003AC8A7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -73,8 +78,6 @@ 50832E261918BB63003AC8A7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 50832E281918BB63003AC8A7 /* the_blue_alliance_iosTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = the_blue_alliance_iosTests.m; sourceTree = ""; }; 50832E331918BB8E003AC8A7 /* The Blue Alliance.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "The Blue Alliance.xcdatamodel"; sourceTree = ""; }; - 50832E351918BBBE003AC8A7 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Event.h; sourceTree = ""; }; - 50832E361918BBBE003AC8A7 /* Event.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Event.m; sourceTree = ""; }; 50832E371918BBBE003AC8A7 /* Event+Create.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Event+Create.h"; sourceTree = ""; }; 50832E381918BBBE003AC8A7 /* Event+Create.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Event+Create.m"; sourceTree = ""; }; 50832E3C1918BBEA003AC8A7 /* EventsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventsViewController.h; sourceTree = ""; }; @@ -126,6 +129,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 5070EE6D192E966B0079D123 /* Team */ = { + isa = PBXGroup; + children = ( + 5070EE67192E95FA0079D123 /* Team.h */, + 5070EE68192E95FA0079D123 /* Team.m */, + ); + name = Team; + sourceTree = ""; + }; 50832DEE1918BB63003AC8A7 = { isa = PBXGroup; children = ( @@ -213,7 +225,8 @@ isa = PBXGroup; children = ( 50832E321918BB8E003AC8A7 /* The Blue Alliance.xcdatamodeld */, - 92B98A5A192DA964004A2513 /* Events */, + 5070EE6D192E966B0079D123 /* Team */, + 92B98A5A192DA964004A2513 /* Event */, ); name = "Data Model"; sourceTree = ""; @@ -243,15 +256,15 @@ name = "Top Level Controllers"; sourceTree = ""; }; - 92B98A5A192DA964004A2513 /* Events */ = { + 92B98A5A192DA964004A2513 /* Event */ = { isa = PBXGroup; children = ( - 50832E351918BBBE003AC8A7 /* Event.h */, - 50832E361918BBBE003AC8A7 /* Event.m */, + 5070EE6A192E965C0079D123 /* Event.h */, + 5070EE6B192E965C0079D123 /* Event.m */, 50832E371918BBBE003AC8A7 /* Event+Create.h */, 50832E381918BBBE003AC8A7 /* Event+Create.m */, ); - name = Events; + name = Event; sourceTree = ""; }; 92C5B871192C0BC400AFDBCA /* Events */ = { @@ -375,7 +388,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\ncat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\nexit 1\nfi\n"; showEnvVarsInLog = 0; }; 816437B6DC96402F891C1218 /* Copy Pods Resources */ = { @@ -408,11 +421,12 @@ 9283A261192EEE5800B9068B /* EventGroup.m in Sources */, 50832E341918BB8E003AC8A7 /* The Blue Alliance.xcdatamodeld in Sources */, 50832E3E1918BBEA003AC8A7 /* EventsViewController.m in Sources */, - 50832E391918BBBE003AC8A7 /* Event.m in Sources */, + 5070EE69192E95FA0079D123 /* Team.m in Sources */, 5057CD1E1929987D00654304 /* SearchableCoreDataTableViewController.m in Sources */, 50DFD20119207DCA009B686E /* TeamsViewController.m in Sources */, 92C5B870192C0BBC00AFDBCA /* YearSelectView.m in Sources */, 50832E0B1918BB63003AC8A7 /* AppDelegate.m in Sources */, + 5070EE6C192E965C0079D123 /* Event.m in Sources */, 50832E071918BB63003AC8A7 /* main.m in Sources */, 50DFD1F61920365E009B686E /* MenuViewController.m in Sources */, ); diff --git a/the-blue-alliance-ios/Event+Create.m b/the-blue-alliance-ios/Event+Create.m index e58b93e70..e11512a13 100644 --- a/the-blue-alliance-ios/Event+Create.m +++ b/the-blue-alliance-ios/Event+Create.m @@ -59,6 +59,7 @@ + (Event *)createEventFromTBAInfo:(NSDictionary *)info event.start_date = [formatter dateFromString:info[@"start_date"]]; event.end_date = [formatter dateFromString:info[@"end_date"]]; event.event_type = info[@"event_type"]; + // TODO: Finish / improve importing NSLog(@"Imported event %@ into the database", key); } diff --git a/the-blue-alliance-ios/Team.h b/the-blue-alliance-ios/Team.h new file mode 100644 index 000000000..15b74a4b5 --- /dev/null +++ b/the-blue-alliance-ios/Team.h @@ -0,0 +1,34 @@ +// +// Team.h +// the-blue-alliance-ios +// +// Created by Donald Pinckney on 5/22/14. +// Copyright (c) 2014 The Blue Alliance. All rights reserved. +// + +#import +#import + +@class Event; + +@interface Team : NSManagedObject + +@property (nonatomic, retain) NSString *key; +@property (nonatomic, retain) NSNumber *number; +@property (nonatomic, retain) NSString *name; +@property (nonatomic, retain) NSString *nickname; +@property (nonatomic, retain) NSString *address; +@property (nonatomic, retain) NSNumber *last_updated; + +@property (nonatomic, retain) NSSet *events; +@end + +@interface Team (CoreDataGeneratedAccessors) + +- (void)addEventsObject:(Event *)value; +- (void)removeEventsObject:(Event *)value; + +- (void)addEvents:(NSSet *)values; +- (void)removeEvents:(NSSet *)values; + +@end diff --git a/the-blue-alliance-ios/Team.m b/the-blue-alliance-ios/Team.m new file mode 100644 index 000000000..1f41588b3 --- /dev/null +++ b/the-blue-alliance-ios/Team.m @@ -0,0 +1,23 @@ +// +// Team.m +// the-blue-alliance-ios +// +// Created by Donald Pinckney on 5/22/14. +// Copyright (c) 2014 The Blue Alliance. All rights reserved. +// + +#import "Team.h" +#import "Event.h" + + +@implementation Team + +@dynamic key; +@dynamic number; +@dynamic name; +@dynamic nickname; +@dynamic address; +@dynamic last_updated; +@dynamic events; + +@end diff --git a/the-blue-alliance-ios/The Blue Alliance.xcdatamodeld/The Blue Alliance.xcdatamodel/contents b/the-blue-alliance-ios/The Blue Alliance.xcdatamodeld/The Blue Alliance.xcdatamodel/contents index 0d3e09130..09bfa3276 100644 --- a/the-blue-alliance-ios/The Blue Alliance.xcdatamodeld/The Blue Alliance.xcdatamodel/contents +++ b/the-blue-alliance-ios/The Blue Alliance.xcdatamodeld/The Blue Alliance.xcdatamodel/contents @@ -20,8 +20,19 @@ + + + + + + + + + + - + + \ No newline at end of file