Created
March 26, 2016 19:13
-
-
Save DLSteve/812ebb274b99f1ada471 to your computer and use it in GitHub Desktop.
Realm Seed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)didClickAddButton:(UIBarButtonItem *)sender { | |
NSArray *time = @[@"10:00", @"11:00", @"12:00", @"1:00", @"2:00", @"3:00", @"4:00", @"5:00", @"6:00", @"7:00", @"8:00"]; | |
NSArray *zoneName = @[@"Vestibule / Front End Area",@"Sales Floor",@"Receiving Area",@"Building Specific",]; | |
NSArray *checkItems = @[ | |
@[@"Trash, spills & trip hazards",@"Electrical hazards",@"Emergency exits",@"Optical",@"Entrance / Exit"], | |
@[@"Trash, spills & trip hazards",@"Electrical hazards",@"Emergency exits",@"Merchandise issues",@"Road shows",@"Unattended pallet jacks",@"Walk-in coolers",@"Demo areas",@"Display safety",@"Jewelry / Alarmed displays"], | |
@[@"Trash, spills & trip hazards",@"Electrical hazards",@"Emergency exits",@"Safe stacks / storage",@"Roof hatch",@"Overhead heaters",@"Compactors",@"Re-wrap machine",@"RTV",@"Receiving doors",@"Eye wash station"], | |
@[] | |
]; | |
for (int i = 0; i < time.count; i++) { | |
FloorWalk *walk = [FloorWalk floorWalkWithTimePeriod:time[i]]; | |
for (int i = 0; i < zoneName.count; i++) { | |
NSNumber *zoneNumber = [NSNumber numberWithInt:i + 1]; | |
NSArray *checkDesc = [NSArray arrayWithArray:checkItems[i]]; | |
for (int j = 0; j < checkDesc.count; j++) { | |
Check *check = [Check checkWithZoneDescription:zoneName[i] zoneNumber:zoneNumber checkDescription:checkDesc[j]]; | |
[walk.checks addObject:check]; | |
} | |
} | |
[[RLMRealm defaultRealm] beginWriteTransaction]; | |
[[RLMRealm defaultRealm] addObjectWithNotification:walk]; | |
[[RLMRealm defaultRealm] commitWriteTransaction]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment