├── .gitignore ├── Example ├── INSElectronicProgramGuideLayout.xcodeproj │ └── project.pbxproj ├── INSElectronicProgramGuideLayout │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Channel.h │ ├── Channel.m │ ├── Entry.h │ ├── Entry.m │ ├── INSEPGViewController.h │ ├── INSEPGViewController.m │ ├── INSFloatingHeadersEPGViewController.h │ ├── INSFloatingHeadersEPGViewController.m │ ├── ISCurrentTimeGridlineView.h │ ├── ISCurrentTimeGridlineView.m │ ├── ISCurrentTimeIndicatorView.h │ ├── ISCurrentTimeIndicatorView.m │ ├── ISCurrentTimeIndicatorView.xib │ ├── ISDashedLineView.h │ ├── ISDashedLineView.m │ ├── ISEPGCell.h │ ├── ISEPGCell.m │ ├── ISEPGCell.xib │ ├── ISFloatingCell.h │ ├── ISFloatingCell.m │ ├── ISFloatingCell.xib │ ├── ISFloatingCellOverlay.h │ ├── ISFloatingCellOverlay.m │ ├── ISFloatingCellOverlay.xib │ ├── ISGridlineView.h │ ├── ISGridlineView.m │ ├── ISHalfHourLineView.h │ ├── ISHalfHourLineView.m │ ├── ISHeaderBackgroundView.h │ ├── ISHeaderBackgroundView.m │ ├── ISHourHeader.h │ ├── ISHourHeader.m │ ├── ISHourHeader.xib │ ├── ISHourHeaderBackgroundView.h │ ├── ISHourHeaderBackgroundView.m │ ├── ISSectionHeader.h │ ├── ISSectionHeader.m │ ├── ISSectionHeader.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ ├── activity.imageset │ │ │ ├── Contents.json │ │ │ └── activity@2x.png │ │ ├── backgroundImage.imageset │ │ │ ├── Contents.json │ │ │ ├── backgroundImage.png │ │ │ ├── backgroundImage5-1.png │ │ │ ├── backgroundImage5.png │ │ │ └── backgroundImage@2x.png │ │ └── explore.imageset │ │ │ ├── Contents.json │ │ │ └── explore@2x.png │ ├── Info.plist │ ├── Model.xcdatamodeld │ │ └── Model.xcdatamodel │ │ │ └── contents │ ├── Prefix.h │ └── main.m ├── INSElectronicProgramGuideLayoutTests │ ├── INSElectronicProgramGuideLayoutTests.m │ └── Info.plist ├── Podfile ├── Podfile.lock └── Pods │ ├── Headers │ ├── Private │ │ ├── LoremIpsum │ │ │ └── LoremIpsum.h │ │ ├── MagicalRecord │ │ │ └── MagicalRecord │ │ │ │ ├── MagicalImportFunctions.h │ │ │ │ ├── MagicalRecord+Actions.h │ │ │ │ ├── MagicalRecord+ErrorHandling.h │ │ │ │ ├── MagicalRecord+Options.h │ │ │ │ ├── MagicalRecord+Setup.h │ │ │ │ ├── MagicalRecord+ShorthandMethods.h │ │ │ │ ├── MagicalRecord+iCloud.h │ │ │ │ ├── MagicalRecord.h │ │ │ │ ├── MagicalRecordDeprecationMacros.h │ │ │ │ ├── MagicalRecordInternal.h │ │ │ │ ├── MagicalRecordLogging.h │ │ │ │ ├── MagicalRecordXcode7CompatibilityMacros.h │ │ │ │ ├── NSAttributeDescription+MagicalDataImport.h │ │ │ │ ├── NSEntityDescription+MagicalDataImport.h │ │ │ │ ├── NSManagedObject+MagicalAggregation.h │ │ │ │ ├── NSManagedObject+MagicalDataImport.h │ │ │ │ ├── NSManagedObject+MagicalFinders.h │ │ │ │ ├── NSManagedObject+MagicalRecord.h │ │ │ │ ├── NSManagedObject+MagicalRequests.h │ │ │ │ ├── NSManagedObjectContext+MagicalChainSave.h │ │ │ │ ├── NSManagedObjectContext+MagicalObserving.h │ │ │ │ ├── NSManagedObjectContext+MagicalRecord.h │ │ │ │ ├── NSManagedObjectContext+MagicalSaves.h │ │ │ │ ├── NSManagedObjectContext+MagicalThreading.h │ │ │ │ ├── NSManagedObjectModel+MagicalRecord.h │ │ │ │ ├── NSNumber+MagicalDataImport.h │ │ │ │ ├── NSObject+MagicalDataImport.h │ │ │ │ ├── NSPersistentStore+MagicalRecord.h │ │ │ │ ├── NSPersistentStoreCoordinator+MagicalRecord.h │ │ │ │ ├── NSRelationshipDescription+MagicalDataImport.h │ │ │ │ └── NSString+MagicalDataImport.h │ │ └── UIColor+MLPFlatColors │ │ │ └── UIColor+MLPFlatColors.h │ └── Public │ │ ├── LoremIpsum │ │ └── LoremIpsum.h │ │ ├── MagicalRecord │ │ └── MagicalRecord │ │ │ ├── MagicalImportFunctions.h │ │ │ ├── MagicalRecord+Actions.h │ │ │ ├── MagicalRecord+ErrorHandling.h │ │ │ ├── MagicalRecord+Options.h │ │ │ ├── MagicalRecord+Setup.h │ │ │ ├── MagicalRecord+ShorthandMethods.h │ │ │ ├── MagicalRecord+iCloud.h │ │ │ ├── MagicalRecord.h │ │ │ ├── MagicalRecordDeprecationMacros.h │ │ │ ├── MagicalRecordInternal.h │ │ │ ├── MagicalRecordLogging.h │ │ │ ├── MagicalRecordXcode7CompatibilityMacros.h │ │ │ ├── NSAttributeDescription+MagicalDataImport.h │ │ │ ├── NSEntityDescription+MagicalDataImport.h │ │ │ ├── NSManagedObject+MagicalAggregation.h │ │ │ ├── NSManagedObject+MagicalDataImport.h │ │ │ ├── NSManagedObject+MagicalFinders.h │ │ │ ├── NSManagedObject+MagicalRecord.h │ │ │ ├── NSManagedObject+MagicalRequests.h │ │ │ ├── NSManagedObjectContext+MagicalChainSave.h │ │ │ ├── NSManagedObjectContext+MagicalObserving.h │ │ │ ├── NSManagedObjectContext+MagicalRecord.h │ │ │ ├── NSManagedObjectContext+MagicalSaves.h │ │ │ ├── NSManagedObjectContext+MagicalThreading.h │ │ │ ├── NSManagedObjectModel+MagicalRecord.h │ │ │ ├── NSNumber+MagicalDataImport.h │ │ │ ├── NSObject+MagicalDataImport.h │ │ │ ├── NSPersistentStore+MagicalRecord.h │ │ │ ├── NSPersistentStoreCoordinator+MagicalRecord.h │ │ │ ├── NSRelationshipDescription+MagicalDataImport.h │ │ │ └── NSString+MagicalDataImport.h │ │ └── UIColor+MLPFlatColors │ │ └── UIColor+MLPFlatColors.h │ ├── LoremIpsum │ ├── License.markdown │ ├── LoremIpsum │ │ ├── LoremIpsum.h │ │ └── LoremIpsum.m │ └── Readme.markdown │ ├── MagicalRecord │ ├── LICENSE │ ├── MagicalRecord │ │ ├── Categories │ │ │ ├── DataImport │ │ │ │ ├── MagicalImportFunctions.h │ │ │ │ ├── MagicalImportFunctions.m │ │ │ │ ├── NSAttributeDescription+MagicalDataImport.h │ │ │ │ ├── NSAttributeDescription+MagicalDataImport.m │ │ │ │ ├── NSEntityDescription+MagicalDataImport.h │ │ │ │ ├── NSEntityDescription+MagicalDataImport.m │ │ │ │ ├── NSNumber+MagicalDataImport.h │ │ │ │ ├── NSNumber+MagicalDataImport.m │ │ │ │ ├── NSObject+MagicalDataImport.h │ │ │ │ ├── NSObject+MagicalDataImport.m │ │ │ │ ├── NSRelationshipDescription+MagicalDataImport.h │ │ │ │ ├── NSRelationshipDescription+MagicalDataImport.m │ │ │ │ ├── NSString+MagicalDataImport.h │ │ │ │ └── NSString+MagicalDataImport.m │ │ │ ├── NSManagedObject │ │ │ │ ├── NSManagedObject+MagicalAggregation.h │ │ │ │ ├── NSManagedObject+MagicalAggregation.m │ │ │ │ ├── NSManagedObject+MagicalDataImport.h │ │ │ │ ├── NSManagedObject+MagicalDataImport.m │ │ │ │ ├── NSManagedObject+MagicalFinders.h │ │ │ │ ├── NSManagedObject+MagicalFinders.m │ │ │ │ ├── NSManagedObject+MagicalRecord.h │ │ │ │ ├── NSManagedObject+MagicalRecord.m │ │ │ │ ├── NSManagedObject+MagicalRequests.h │ │ │ │ └── NSManagedObject+MagicalRequests.m │ │ │ ├── NSManagedObjectContext │ │ │ │ ├── NSManagedObjectContext+MagicalChainSave.h │ │ │ │ ├── NSManagedObjectContext+MagicalChainSave.m │ │ │ │ ├── NSManagedObjectContext+MagicalObserving.h │ │ │ │ ├── NSManagedObjectContext+MagicalObserving.m │ │ │ │ ├── NSManagedObjectContext+MagicalRecord.h │ │ │ │ ├── NSManagedObjectContext+MagicalRecord.m │ │ │ │ ├── NSManagedObjectContext+MagicalSaves.h │ │ │ │ ├── NSManagedObjectContext+MagicalSaves.m │ │ │ │ ├── NSManagedObjectContext+MagicalThreading.h │ │ │ │ └── NSManagedObjectContext+MagicalThreading.m │ │ │ ├── NSManagedObjectModel+MagicalRecord.h │ │ │ ├── NSManagedObjectModel+MagicalRecord.m │ │ │ ├── NSPersistentStore+MagicalRecord.h │ │ │ ├── NSPersistentStore+MagicalRecord.m │ │ │ ├── NSPersistentStoreCoordinator+MagicalRecord.h │ │ │ └── NSPersistentStoreCoordinator+MagicalRecord.m │ │ ├── Core │ │ │ ├── MagicalRecord+Actions.h │ │ │ ├── MagicalRecord+Actions.m │ │ │ ├── MagicalRecord+ErrorHandling.h │ │ │ ├── MagicalRecord+ErrorHandling.m │ │ │ ├── MagicalRecord+Options.h │ │ │ ├── MagicalRecord+Options.m │ │ │ ├── MagicalRecord+Setup.h │ │ │ ├── MagicalRecord+Setup.m │ │ │ ├── MagicalRecord+ShorthandMethods.h │ │ │ ├── MagicalRecord+ShorthandMethods.m │ │ │ ├── MagicalRecord+iCloud.h │ │ │ ├── MagicalRecord+iCloud.m │ │ │ ├── MagicalRecordDeprecationMacros.h │ │ │ ├── MagicalRecordInternal.h │ │ │ ├── MagicalRecordInternal.m │ │ │ ├── MagicalRecordLogging.h │ │ │ └── MagicalRecordXcode7CompatibilityMacros.h │ │ └── MagicalRecord.h │ └── README.md │ ├── Manifest.lock │ ├── Pods.xcodeproj │ └── project.pbxproj │ ├── Target Support Files │ ├── LoremIpsum │ │ ├── LoremIpsum-dummy.m │ │ ├── LoremIpsum-prefix.pch │ │ └── LoremIpsum.xcconfig │ ├── MagicalRecord │ │ ├── MagicalRecord-dummy.m │ │ ├── MagicalRecord-prefix.pch │ │ └── MagicalRecord.xcconfig │ ├── Pods-INSElectronicProgramGuideLayout │ │ ├── Pods-INSElectronicProgramGuideLayout-acknowledgements.markdown │ │ ├── Pods-INSElectronicProgramGuideLayout-acknowledgements.plist │ │ ├── Pods-INSElectronicProgramGuideLayout-dummy.m │ │ ├── Pods-INSElectronicProgramGuideLayout-frameworks.sh │ │ ├── Pods-INSElectronicProgramGuideLayout-resources.sh │ │ ├── Pods-INSElectronicProgramGuideLayout.debug.xcconfig │ │ └── Pods-INSElectronicProgramGuideLayout.release.xcconfig │ └── UIColor+MLPFlatColors │ │ ├── UIColor+MLPFlatColors-dummy.m │ │ ├── UIColor+MLPFlatColors-prefix.pch │ │ └── UIColor+MLPFlatColors.xcconfig │ └── UIColor+MLPFlatColors │ ├── LICENSE.md │ ├── README.md │ └── UIColor+MLPFlatColors │ ├── UIColor+MLPFlatColors.h │ └── UIColor+MLPFlatColors.m ├── INSElectronicProgramGuideLayout.podspec ├── INSElectronicProgramGuideLayout ├── INSElectronicProgramGuideLayout.h ├── INSElectronicProgramGuideLayout.m ├── INSTimerWeakTarget.h ├── INSTimerWeakTarget.m ├── NSDate+INSUtils.h └── NSDate+INSUtils.m ├── LICENSE ├── README.md └── Screens ├── animation.gif └── screen.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | # Pods/ 20 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "Channel.h" 11 | #import "Entry.h" 12 | #import "NSDate+INSUtils.h" 13 | #import 14 | 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | 24 | [MagicalRecord setupAutoMigratingCoreDataStack]; 25 | 26 | if ([Channel MR_countOfEntities] <= 0) { 27 | for (NSInteger i=0; i < 16; i++) { 28 | Channel *channel = [Channel MR_createEntity]; 29 | channel.iD = @(i); 30 | channel.name = [NSString stringWithFormat:@"CHANNEL %ld",(long)i]; 31 | 32 | NSDate *startDate = [[NSDate date] dateByAddingTimeInterval:-3600*24]; 33 | NSDate *lastDate = [startDate copy]; 34 | NSDate *endDate = [startDate dateByAddingTimeInterval:3600*72]; 35 | 36 | while ([lastDate ins_isEarlierThan:endDate]) { 37 | Entry *entry = [Entry MR_createEntity]; 38 | entry.startDate = lastDate; 39 | NSInteger duration = arc4random_uniform(6300) + 900; 40 | NSDate *newLastDate = [lastDate dateByAddingTimeInterval:duration]; 41 | entry.endDate = newLastDate; 42 | entry.channel = channel; 43 | lastDate = newLastDate; 44 | 45 | entry.title = [[LoremIpsum wordsWithNumber:arc4random_uniform(5) + 2] capitalizedString]; 46 | } 47 | } 48 | } 49 | 50 | 51 | 52 | [[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait]; 53 | 54 | return YES; 55 | } 56 | 57 | - (void)applicationWillResignActive:(UIApplication *)application { 58 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 59 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 60 | } 61 | 62 | - (void)applicationDidEnterBackground:(UIApplication *)application { 63 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 64 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 65 | } 66 | 67 | - (void)applicationWillEnterForeground:(UIApplication *)application { 68 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 69 | } 70 | 71 | - (void)applicationDidBecomeActive:(UIApplication *)application { 72 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 73 | } 74 | 75 | - (void)applicationWillTerminate:(UIApplication *)application { 76 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Channel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Channel.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface Channel : NSManagedObject 14 | 15 | @property (nonatomic, retain) NSNumber * iD; 16 | @property (nonatomic, retain) NSString * name; 17 | @property (nonatomic, retain) NSManagedObject *entries; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Channel.m: -------------------------------------------------------------------------------- 1 | // 2 | // Channel.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "Channel.h" 10 | 11 | 12 | @implementation Channel 13 | 14 | @dynamic iD; 15 | @dynamic name; 16 | @dynamic entries; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Entry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Entry.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class Channel; 13 | 14 | @interface Entry : NSManagedObject 15 | 16 | @property (nonatomic, retain) NSDate * startDate; 17 | @property (nonatomic, retain) NSDate * endDate; 18 | @property (nonatomic, retain) NSString * title; 19 | @property (nonatomic, retain) Channel *channel; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Entry.m: -------------------------------------------------------------------------------- 1 | // 2 | // Entry.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "Entry.h" 10 | #import "Channel.h" 11 | 12 | 13 | @implementation Entry 14 | 15 | @dynamic startDate; 16 | @dynamic endDate; 17 | @dynamic channel; 18 | @dynamic title; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/INSEPGViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // INSEPGViewController.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 18.12.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface INSEPGViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/INSFloatingHeadersEPGViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface INSFloatingHeadersEPGViewController : UICollectionViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISCurrentTimeGridlineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISCurrentTimeGridlineView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISCurrentTimeGridlineView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISCurrentTimeGridlineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISCurrentTimeGridlineView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISCurrentTimeGridlineView.h" 10 | 11 | @implementation ISCurrentTimeGridlineView 12 | 13 | 14 | 15 | - (id)initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | self.backgroundColor = [UIColor lightGrayColor]; 20 | } 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISCurrentTimeIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationCurrentTimeIndicatorView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISCurrentTimeIndicatorView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISCurrentTimeIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationCurrentTimeIndicatorView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISCurrentTimeIndicatorView.h" 10 | 11 | @interface ISCurrentTimeIndicatorView () 12 | @property (nonatomic, weak) IBOutlet UILabel *currentTimeLabel; 13 | @property (nonatomic, retain) NSTimer *minuteTimer; 14 | @end 15 | 16 | @implementation ISCurrentTimeIndicatorView 17 | 18 | - (void)awakeFromNib 19 | { 20 | [super awakeFromNib]; 21 | 22 | NSCalendar *calendar = [NSCalendar currentCalendar]; 23 | NSDate *oneMinuteInFuture = [[NSDate date] dateByAddingTimeInterval:60]; 24 | NSDateComponents *components = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:oneMinuteInFuture]; 25 | NSDate *nextMinuteBoundary = [calendar dateFromComponents:components]; 26 | 27 | self.minuteTimer = [[NSTimer alloc] initWithFireDate:nextMinuteBoundary interval:60 target:self selector:@selector(minuteTick:) userInfo:nil repeats:YES]; 28 | [[NSRunLoop currentRunLoop] addTimer:self.minuteTimer forMode:NSDefaultRunLoopMode]; 29 | 30 | [self updateTime]; 31 | 32 | } 33 | 34 | #pragma mark - MSCurrentTimeIndicator 35 | 36 | - (void)minuteTick:(id)sender 37 | { 38 | [self updateTime]; 39 | } 40 | 41 | - (void)updateTime 42 | { 43 | NSDateFormatter *dateFormatter = [NSDateFormatter new]; 44 | [dateFormatter setDateFormat:@"HH:mm"]; 45 | self.currentTimeLabel.text = [dateFormatter stringFromDate:[NSDate date]]; 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISCurrentTimeIndicatorView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Exo2-SemiBold 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISDashedLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISDashedLineView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISDashedLineView : UIView 12 | @property (nonatomic, assign) IBInspectable CGFloat lineWidth; 13 | @property (nonatomic, strong) IBInspectable UIColor *lineColor; 14 | @end 15 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISDashedLineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISDashedLineView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISDashedLineView.h" 10 | 11 | @implementation ISDashedLineView 12 | 13 | + (Class)layerClass { 14 | return [CAShapeLayer class]; 15 | } 16 | 17 | - (void)setLineColor:(UIColor *)lineColor 18 | { 19 | _lineColor = lineColor; 20 | 21 | CAShapeLayer *shapeLayer = (CAShapeLayer *)self.layer; 22 | [shapeLayer setStrokeColor:[self.lineColor CGColor]]; 23 | } 24 | 25 | - (void)setLineWidth:(CGFloat)lineWidth 26 | { 27 | _lineWidth = lineWidth; 28 | 29 | CAShapeLayer *shapeLayer = (CAShapeLayer *)self.layer; 30 | [shapeLayer setBounds:self.bounds]; 31 | [shapeLayer setPosition:self.center]; 32 | [shapeLayer setFillColor:[[UIColor clearColor] CGColor]]; 33 | [shapeLayer setStrokeColor:[self.lineColor CGColor]]; 34 | [shapeLayer setLineWidth:self.lineWidth]; 35 | [shapeLayer setLineJoin:kCALineJoinRound]; 36 | [shapeLayer setLineDashPattern: 37 | [NSArray arrayWithObjects:[NSNumber numberWithInt:5], 38 | [NSNumber numberWithInt:5],nil]]; 39 | 40 | // Setup the path 41 | CGMutablePathRef path = CGPathCreateMutable(); 42 | CGPathMoveToPoint(path, NULL, 0, 0); 43 | CGPathAddLineToPoint(path, NULL, 0, self.bounds.size.height); 44 | 45 | [shapeLayer setPath:path]; 46 | CGPathRelease(path); 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISEPGCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationCell.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISEPGCell : UICollectionViewCell 12 | @end 13 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISEPGCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationCell.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISEPGCell.h" 10 | @interface ISEPGCell () 11 | @end 12 | 13 | @implementation ISEPGCell 14 | 15 | - (void)awakeFromNib 16 | { 17 | [super awakeFromNib]; 18 | 19 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 20 | self.contentView.translatesAutoresizingMaskIntoConstraints = YES; 21 | } 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISEPGCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISFloatingCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISFloatingCell.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 18.12.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISFloatingCell : UICollectionViewCell 12 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 13 | @property (weak, nonatomic) IBOutlet UILabel *dateLabel; 14 | @property (weak, nonatomic) IBOutlet UIView *topBorderView; 15 | @property (weak, nonatomic) IBOutlet UIView *leftBorderView; 16 | 17 | - (void)setDate:(NSDate *)date; 18 | @end 19 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISFloatingCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISFloatingCell.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 18.12.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISFloatingCell.h" 10 | #import 11 | 12 | @implementation ISFloatingCell 13 | 14 | + (NSDateFormatter *)sharedTimeRowHeaderDateFormatter 15 | { 16 | static dispatch_once_t once; 17 | static NSDateFormatter *_sharedTimeRowHeaderDateFormatter; 18 | dispatch_once(&once, ^ { _sharedTimeRowHeaderDateFormatter = [[NSDateFormatter alloc] init]; 19 | _sharedTimeRowHeaderDateFormatter.dateFormat = @"HH:mm"; 20 | }); 21 | return _sharedTimeRowHeaderDateFormatter; 22 | } 23 | 24 | - (void)awakeFromNib 25 | { 26 | [super awakeFromNib]; 27 | 28 | UIColor *randomColor = [UIColor randomFlatLightColor]; 29 | self.topBorderView.backgroundColor = randomColor; 30 | self.leftBorderView.backgroundColor = randomColor; 31 | 32 | self.layer.rasterizationScale = [UIScreen mainScreen].scale; 33 | self.layer.shouldRasterize = YES; 34 | 35 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 36 | self.contentView.translatesAutoresizingMaskIntoConstraints = YES; 37 | } 38 | 39 | - (void)setDate:(NSDate *)date 40 | { 41 | self.dateLabel.text = [[[self class] sharedTimeRowHeaderDateFormatter] stringFromDate:date]; 42 | 43 | [self setNeedsLayout]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISFloatingCellOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISFloatingOverlay.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 04.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISFloatingCellOverlay : UICollectionReusableView 12 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 13 | @property (weak, nonatomic) IBOutlet UILabel *dateLabel; 14 | @property (weak, nonatomic) IBOutlet UIView *topBorderView; 15 | @property (weak, nonatomic) IBOutlet UIView *leftBorderView; 16 | 17 | - (void)setDate:(NSDate *)date; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISFloatingCellOverlay.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISFloatingOverlay.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 04.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISFloatingCellOverlay.h" 10 | #import 11 | 12 | @implementation ISFloatingCellOverlay 13 | 14 | - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event 15 | { 16 | return NO; 17 | } 18 | 19 | + (NSDateFormatter *)sharedTimeRowHeaderDateFormatter 20 | { 21 | static dispatch_once_t once; 22 | static NSDateFormatter *_sharedTimeRowHeaderDateFormatter; 23 | dispatch_once(&once, ^ { _sharedTimeRowHeaderDateFormatter = [[NSDateFormatter alloc] init]; 24 | _sharedTimeRowHeaderDateFormatter.dateFormat = @"HH:mm"; 25 | }); 26 | return _sharedTimeRowHeaderDateFormatter; 27 | } 28 | 29 | - (void)awakeFromNib 30 | { 31 | [super awakeFromNib]; 32 | 33 | UIColor *randomColor = [UIColor randomFlatLightColor]; 34 | self.topBorderView.backgroundColor = randomColor; 35 | self.leftBorderView.backgroundColor = randomColor; 36 | 37 | self.layer.rasterizationScale = [UIScreen mainScreen].scale; 38 | self.layer.shouldRasterize = YES; 39 | self.userInteractionEnabled = NO; 40 | } 41 | 42 | - (void)setDate:(NSDate *)date 43 | { 44 | self.dateLabel.text = [[[self class] sharedTimeRowHeaderDateFormatter] stringFromDate:date]; 45 | 46 | [self setNeedsLayout]; 47 | } 48 | @end 49 | 50 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISGridlineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationGridlineView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISGridlineView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISGridlineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationGridlineView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISGridlineView.h" 10 | 11 | @implementation ISGridlineView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | self.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.3]; 18 | } 19 | return self; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHalfHourLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationHalfHourLineView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISHalfHourLineView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHalfHourLineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationHalfHourLineView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISHalfHourLineView.h" 10 | #import "ISDashedLineView.h" 11 | 12 | @interface ISHalfHourLineView () 13 | @property (nonatomic, strong) ISDashedLineView *dashLine; 14 | @end 15 | 16 | @implementation ISHalfHourLineView 17 | 18 | - (id)initWithFrame:(CGRect)frame 19 | { 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | self.clipsToBounds = YES; 23 | self.dashLine = [[ISDashedLineView alloc] initWithFrame:self.bounds]; 24 | [self addSubview:self.dashLine]; 25 | 26 | self.dashLine.lineColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.3]; 27 | self.dashLine.lineWidth = 3; 28 | } 29 | return self; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHeaderBackgroundView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationHeaderBackgroundView.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISHeaderBackgroundView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHeaderBackgroundView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationHeaderBackgroundView.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISHeaderBackgroundView.h" 10 | 11 | @implementation ISHeaderBackgroundView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2]; 18 | 19 | } 20 | return self; 21 | } 22 | 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHourHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationTimeRowHeader.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISHourHeader : UICollectionReusableView 12 | @property (nonatomic, strong) NSDate *time; 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHourHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationTimeRowHeader.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISHourHeader.h" 10 | 11 | @interface ISHourHeader () 12 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 13 | @end 14 | 15 | @implementation ISHourHeader 16 | 17 | + (NSDateFormatter *)sharedTimeRowHeaderDateFormatter 18 | { 19 | static dispatch_once_t once; 20 | static NSDateFormatter *_sharedTimeRowHeaderDateFormatter; 21 | dispatch_once(&once, ^ { _sharedTimeRowHeaderDateFormatter = [[NSDateFormatter alloc] init]; 22 | _sharedTimeRowHeaderDateFormatter.dateFormat = @"HH:mm"; 23 | }); 24 | return _sharedTimeRowHeaderDateFormatter; 25 | } 26 | 27 | - (void)setTime:(NSDate *)time 28 | { 29 | _time = time; 30 | 31 | self.timeLabel.text = [[[self class] sharedTimeRowHeaderDateFormatter] stringFromDate:time]; 32 | 33 | [self setNeedsLayout]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHourHeader.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Exo2-Light 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHourHeaderBackgroundView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISHourHeaderBackgroundView.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISHourHeaderBackgroundView : UICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISHourHeaderBackgroundView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISHourHeaderBackgroundView.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISHourHeaderBackgroundView.h" 10 | 11 | @implementation ISHourHeaderBackgroundView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8]; 18 | // self.layer.shadowColor = [UIColor blackColor].CGColor; 19 | // self.layer.shadowOpacity = 1.0; 20 | // self.layer.shadowOffset = CGSizeMake(0.0, -2.0); 21 | // self.layer.shadowRadius = 8.0; 22 | // self.layer.rasterizationScale = [UIScreen mainScreen].scale; 23 | // self.layer.shouldRasterize = YES; 24 | } 25 | return self; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISSectionHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationDayColumnHeader.h 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ISSectionHeader : UICollectionReusableView 12 | @property (nonatomic, weak) IBOutlet UILabel *dayLabel; 13 | @end 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISSectionHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // ISReservationDayColumnHeader.m 3 | // iLumio Guest 4 | // 5 | // Created by Michał Zaborowski on 20.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import "ISSectionHeader.h" 10 | 11 | @interface ISSectionHeader () 12 | 13 | @end 14 | 15 | @implementation ISSectionHeader 16 | 17 | 18 | 19 | + (NSDateFormatter *)sharedDayColumnHeaderDateFormatter 20 | { 21 | static dispatch_once_t once; 22 | static NSDateFormatter *_sharedDayColumnHeaderDateFormatter; 23 | dispatch_once(&once, ^ { _sharedDayColumnHeaderDateFormatter = [[NSDateFormatter alloc] init]; 24 | _sharedDayColumnHeaderDateFormatter.dateFormat = ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? @"EEE MMM d" : @"EEEE MMMM d, YYYY"); 25 | }); 26 | return _sharedDayColumnHeaderDateFormatter; 27 | } 28 | 29 | - (void)setDay:(NSDate *)day 30 | { 31 | 32 | 33 | self.dayLabel.text = [[[self class] sharedDayColumnHeaderDateFormatter] stringFromDate:day]; 34 | 35 | [self setNeedsLayout]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/ISSectionHeader.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/activity.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "activity@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/activity.imageset/activity@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/activity.imageset/activity@2x.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x", 6 | "filename" : "backgroundImage.png" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "2x", 11 | "filename" : "backgroundImage@2x.png" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "filename" : "backgroundImage5.png", 16 | "subtype" : "retina4", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "idiom" : "iphone", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "scale" : "1x", 26 | "filename" : "backgroundImage5-1.png" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "scale" : "2x" 31 | } 32 | ], 33 | "info" : { 34 | "version" : 1, 35 | "author" : "xcode" 36 | } 37 | } -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage5-1.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage5.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/backgroundImage.imageset/backgroundImage@2x.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/explore.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "explore@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Images.xcassets/explore.imageset/explore@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Example/INSElectronicProgramGuideLayout/Images.xcassets/explore.imageset/explore@2x.png -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | io.inspace.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Model.xcdatamodeld/Model.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/Prefix.h: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 05.10.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #ifdef __OBJC__ 10 | #import 11 | #import 12 | #import 13 | #endif 14 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayout/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayoutTests/INSElectronicProgramGuideLayoutTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // INSElectronicProgramGuideLayoutTests.m 3 | // INSElectronicProgramGuideLayoutTests 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface INSElectronicProgramGuideLayoutTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation INSElectronicProgramGuideLayoutTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/INSElectronicProgramGuideLayoutTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | io.inspace.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, "7.0" 2 | 3 | target 'INSElectronicProgramGuideLayout' do 4 | pod 'MagicalRecord' 5 | pod 'UIColor+MLPFlatColors' 6 | pod 'LoremIpsum' 7 | end 8 | 9 | inhibit_all_warnings! 10 | 11 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LoremIpsum (1.0.0) 3 | - MagicalRecord (2.3.2): 4 | - MagicalRecord/Core (= 2.3.2) 5 | - MagicalRecord/Core (2.3.2) 6 | - UIColor+MLPFlatColors (1.0) 7 | 8 | DEPENDENCIES: 9 | - LoremIpsum 10 | - MagicalRecord 11 | - UIColor+MLPFlatColors 12 | 13 | SPEC CHECKSUMS: 14 | LoremIpsum: 9029c55d36501b2ee0b05cc9ecda11d3a0479160 15 | MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755 16 | UIColor+MLPFlatColors: 14deb8f28da06ab8918c14231d4ff49ca7cd384a 17 | 18 | PODFILE CHECKSUM: 080e8ffa521c075b8b27ccb3c6428ecd77c84448 19 | 20 | COCOAPODS: 1.0.1 21 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/LoremIpsum/LoremIpsum.h: -------------------------------------------------------------------------------- 1 | ../../../LoremIpsum/LoremIpsum/LoremIpsum.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalImportFunctions.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/MagicalImportFunctions.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+Actions.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Actions.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+ErrorHandling.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+ErrorHandling.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+Options.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Options.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+Setup.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Setup.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+ShorthandMethods.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+ShorthandMethods.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord+iCloud.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+iCloud.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecordDeprecationMacros.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordDeprecationMacros.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecordInternal.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordInternal.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecordLogging.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordLogging.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/MagicalRecordXcode7CompatibilityMacros.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordXcode7CompatibilityMacros.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSAttributeDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSAttributeDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSEntityDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSEntityDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObject+MagicalAggregation.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalAggregation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObject+MagicalFinders.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalFinders.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObject+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObject+MagicalRequests.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRequests.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalChainSave.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalChainSave.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalObserving.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalObserving.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalSaves.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalSaves.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalThreading.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalThreading.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSManagedObjectModel+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectModel+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSNumber+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSNumber+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSObject+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSPersistentStore+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSPersistentStore+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSPersistentStoreCoordinator+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSPersistentStoreCoordinator+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSRelationshipDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSRelationshipDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/MagicalRecord/MagicalRecord/NSString+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSString+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/UIColor+MLPFlatColors/UIColor+MLPFlatColors.h: -------------------------------------------------------------------------------- 1 | ../../../UIColor+MLPFlatColors/UIColor+MLPFlatColors/UIColor+MLPFlatColors.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/LoremIpsum/LoremIpsum.h: -------------------------------------------------------------------------------- 1 | ../../../LoremIpsum/LoremIpsum/LoremIpsum.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalImportFunctions.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/MagicalImportFunctions.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+Actions.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Actions.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+ErrorHandling.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+ErrorHandling.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+Options.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Options.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+Setup.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+Setup.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+ShorthandMethods.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+ShorthandMethods.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord+iCloud.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecord+iCloud.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecordDeprecationMacros.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordDeprecationMacros.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecordInternal.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordInternal.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecordLogging.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordLogging.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/MagicalRecordXcode7CompatibilityMacros.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Core/MagicalRecordXcode7CompatibilityMacros.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSAttributeDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSAttributeDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSEntityDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSEntityDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObject+MagicalAggregation.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalAggregation.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObject+MagicalFinders.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalFinders.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObject+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObject+MagicalRequests.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRequests.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalChainSave.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalChainSave.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalObserving.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalObserving.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalSaves.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalSaves.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectContext+MagicalThreading.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalThreading.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSManagedObjectModel+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSManagedObjectModel+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSNumber+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSNumber+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSObject+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSPersistentStore+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSPersistentStore+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSPersistentStoreCoordinator+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/NSPersistentStoreCoordinator+MagicalRecord.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSRelationshipDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSRelationshipDescription+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/MagicalRecord/MagicalRecord/NSString+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | ../../../../MagicalRecord/MagicalRecord/Categories/DataImport/NSString+MagicalDataImport.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/UIColor+MLPFlatColors/UIColor+MLPFlatColors.h: -------------------------------------------------------------------------------- 1 | ../../../UIColor+MLPFlatColors/UIColor+MLPFlatColors/UIColor+MLPFlatColors.h -------------------------------------------------------------------------------- /Example/Pods/LoremIpsum/License.markdown: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Lukas Kubanek. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2015, Magical Panda Software, LLC 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | * Link to the MagicalRecord Repository at https://github.com/magicalpanda/MagicalRecord in the credits section of your application 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | This software license is in accordance with the standard MIT License. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | OTHER DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/MagicalImportFunctions.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalImportFunctions.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NSDate * __MR_nonnull MR_adjustDateForDST(NSDate *__MR_nonnull date); 13 | NSDate * __MR_nonnull MR_dateFromString(NSString *__MR_nonnull value, NSString *__MR_nonnull format); 14 | NSDate * __MR_nonnull MR_dateFromNumber(NSNumber *__MR_nonnull value, BOOL milliseconds); 15 | NSNumber * __MR_nonnull MR_numberFromString(NSString *__MR_nonnull value); 16 | NSString * __MR_nonnull MR_attributeNameFromString(NSString *__MR_nonnull value); 17 | NSString * __MR_nonnull MR_primaryKeyNameFromString(NSString *__MR_nonnull value); 18 | 19 | #if TARGET_OS_IPHONE 20 | #import 21 | UIColor * __MR_nullable MR_colorFromString(NSString *__MR_nonnull serializedColor); 22 | #else 23 | #import 24 | NSColor * __MR_nullable MR_colorFromString(NSString *__MR_nonnull serializedColor); 25 | #endif 26 | 27 | NSInteger * __MR_nullable MR_newColorComponentsFromString(NSString *__MR_nonnull serializedColor); 28 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/MagicalImportFunctions.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalImportFunctions.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "MagicalImportFunctions.h" 10 | 11 | 12 | #pragma mark - Data import helper functions 13 | 14 | NSString * MR_attributeNameFromString(NSString *value) 15 | { 16 | NSString *firstCharacter = [[value substringToIndex:1] capitalizedString]; 17 | return [firstCharacter stringByAppendingString:[value substringFromIndex:1]]; 18 | } 19 | 20 | NSString * MR_primaryKeyNameFromString(NSString *value) 21 | { 22 | NSString *firstCharacter = [[value substringToIndex:1] lowercaseString]; 23 | return [firstCharacter stringByAppendingFormat:@"%@ID", [value substringFromIndex:1]]; 24 | } 25 | 26 | NSDate * MR_adjustDateForDST(NSDate *date) 27 | { 28 | NSTimeInterval dstOffset = [[NSTimeZone localTimeZone] daylightSavingTimeOffsetForDate:date]; 29 | NSDate *actualDate = [date dateByAddingTimeInterval:dstOffset]; 30 | 31 | return actualDate; 32 | } 33 | 34 | NSDate * MR_dateFromString(NSString *value, NSString *format) 35 | { 36 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 37 | [formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; 38 | [formatter setLocale:[NSLocale currentLocale]]; 39 | [formatter setDateFormat:format]; 40 | 41 | NSDate *parsedDate = [formatter dateFromString:value]; 42 | 43 | return parsedDate; 44 | } 45 | 46 | NSDate * MR_dateFromNumber(NSNumber *value, BOOL milliseconds) 47 | { 48 | NSTimeInterval timeInterval = [value doubleValue]; 49 | if (milliseconds) { 50 | timeInterval = timeInterval / 1000.00; 51 | } 52 | return [NSDate dateWithTimeIntervalSince1970:timeInterval]; 53 | } 54 | 55 | NSNumber * MR_numberFromString(NSString *value) { 56 | return [NSNumber numberWithDouble:[value doubleValue]]; 57 | } 58 | 59 | NSInteger* MR_newColorComponentsFromString(NSString *serializedColor) 60 | { 61 | NSScanner *colorScanner = [NSScanner scannerWithString:serializedColor]; 62 | NSString *colorType; 63 | [colorScanner scanUpToString:@"(" intoString:&colorType]; 64 | 65 | NSInteger *componentValues = malloc(4 * sizeof(NSInteger)); 66 | if (componentValues == NULL) 67 | { 68 | return NULL; 69 | } 70 | 71 | if ([colorType hasPrefix:@"rgba"]) 72 | { 73 | NSCharacterSet *rgbaCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"(,)"]; 74 | 75 | NSInteger *componentValue = componentValues; 76 | while (![colorScanner isAtEnd]) 77 | { 78 | [colorScanner scanCharactersFromSet:rgbaCharacterSet intoString:nil]; 79 | [colorScanner scanInteger:componentValue]; 80 | componentValue++; 81 | } 82 | } 83 | 84 | return componentValues; 85 | } 86 | 87 | #if TARGET_OS_IPHONE 88 | 89 | UIColor * MR_colorFromString(NSString *serializedColor) 90 | { 91 | NSInteger *componentValues = MR_newColorComponentsFromString(serializedColor); 92 | if (componentValues == NULL) 93 | { 94 | return nil; 95 | } 96 | 97 | UIColor *color = [UIColor colorWithRed:(componentValues[0] / 255.0f) 98 | green:(componentValues[1] / 255.0f) 99 | blue:(componentValues[2] / 255.0f) 100 | alpha:componentValues[3]]; 101 | 102 | free(componentValues); 103 | return color; 104 | } 105 | 106 | #else 107 | 108 | NSColor * MR_colorFromString(NSString *serializedColor) 109 | { 110 | NSInteger *componentValues = MR_newColorComponentsFromString(serializedColor); 111 | if (componentValues == NULL) 112 | { 113 | return nil; 114 | } 115 | 116 | NSColor *color = [NSColor colorWithDeviceRed:(componentValues[0] / 255.0f) 117 | green:(componentValues[1] / 255.0f) 118 | blue:(componentValues[2] / 255.0f) 119 | alpha:componentValues[3]]; 120 | free(componentValues); 121 | return color; 122 | } 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSAttributeDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributeDescription+MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSAttributeDescription (MagicalRecord_DataImport) 13 | 14 | - (MR_nullable NSString *) MR_primaryKey; 15 | - (MR_nullable id) MR_valueForKeyPath:(MR_nonnull NSString *)keyPath fromObjectData:(MR_nonnull id)objectData; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSAttributeDescription+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributeDescription+MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSAttributeDescription+MagicalDataImport.h" 10 | #import "NSManagedObject+MagicalDataImport.h" 11 | #import "MagicalImportFunctions.h" 12 | 13 | @implementation NSAttributeDescription (MagicalRecord_DataImport) 14 | 15 | - (NSString *) MR_primaryKey; 16 | { 17 | return nil; 18 | } 19 | 20 | - (id) MR_valueForKeyPath:(NSString *)keyPath fromObjectData:(id)objectData; 21 | { 22 | id value = [objectData valueForKeyPath:keyPath]; 23 | 24 | NSAttributeType attributeType = [self attributeType]; 25 | NSString *desiredAttributeType = [[self userInfo] objectForKey:kMagicalRecordImportAttributeValueClassNameKey]; 26 | if (desiredAttributeType) 27 | { 28 | if ([desiredAttributeType hasSuffix:@"Color"]) 29 | { 30 | value = MR_colorFromString(value); 31 | } 32 | } 33 | else 34 | { 35 | if (attributeType == NSDateAttributeType) 36 | { 37 | if (![value isKindOfClass:[NSDate class]]) 38 | { 39 | NSString *dateFormat = [[self userInfo] objectForKey:kMagicalRecordImportCustomDateFormatKey]; 40 | if ([value isKindOfClass:[NSNumber class]]) { 41 | value = MR_dateFromNumber(value, [dateFormat isEqualToString:kMagicalRecordImportUnixTimeString]); 42 | } 43 | else { 44 | value = MR_dateFromString([value description], dateFormat ?: kMagicalRecordImportDefaultDateFormatString); 45 | } 46 | } 47 | } 48 | else if (attributeType == NSInteger16AttributeType || 49 | attributeType == NSInteger32AttributeType || 50 | attributeType == NSInteger64AttributeType || 51 | attributeType == NSDecimalAttributeType || 52 | attributeType == NSDoubleAttributeType || 53 | attributeType == NSFloatAttributeType) { 54 | if (![value isKindOfClass:[NSNumber class]] && value != [NSNull null]) { 55 | value = MR_numberFromString([value description]); 56 | } 57 | } 58 | else if (attributeType == NSBooleanAttributeType) { 59 | if (![value isKindOfClass:[NSNumber class]] && value != [NSNull null]) { 60 | value = [NSNumber numberWithBool:[value boolValue]]; 61 | } 62 | } 63 | else if (attributeType == NSStringAttributeType) { 64 | if (![value isKindOfClass:[NSString class]] && value != [NSNull null]) { 65 | value = [value description]; 66 | } 67 | } 68 | } 69 | 70 | return value == [NSNull null] ? nil : value; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSEntityDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSEntityDescription+MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/5/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSEntityDescription (MagicalRecord_DataImport) 13 | 14 | - (MR_nullable NSAttributeDescription *) MR_primaryAttributeToRelateBy; 15 | - (MR_nonnull NSManagedObject *) MR_createInstanceInContext:(MR_nonnull NSManagedObjectContext *)context; 16 | 17 | /** 18 | * Safely returns an attribute description for the given name, otherwise returns nil. In certain circumstances, the keys of the dictionary returned by `attributesByName` are not standard NSStrings and won't match using object subscripting or standard `objectForKey:` lookups. 19 | * 20 | * There may be performance implications to using this method if your entity has hundreds or thousands of attributes. 21 | * 22 | * @param name Name of the attribute description in the `attributesByName` dictionary on this instance 23 | * 24 | * @return The attribute description for the given name, otherwise nil 25 | */ 26 | - (MR_nullable NSAttributeDescription *) MR_attributeDescriptionForName:(MR_nonnull NSString *)name; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSEntityDescription+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSEntityDescription+MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/5/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSEntityDescription+MagicalDataImport.h" 10 | #import "NSManagedObject+MagicalDataImport.h" 11 | #import "NSManagedObject+MagicalRecord.h" 12 | #import "MagicalImportFunctions.h" 13 | #import "MagicalRecordLogging.h" 14 | 15 | @implementation NSEntityDescription (MagicalRecord_DataImport) 16 | 17 | - (NSAttributeDescription *) MR_primaryAttributeToRelateBy; 18 | { 19 | NSString *lookupKey = [[self userInfo] objectForKey:kMagicalRecordImportRelationshipLinkedByKey] ?: MR_primaryKeyNameFromString([self name]); 20 | NSAttributeDescription *attributeDescription = [self MR_attributeDescriptionForName:lookupKey]; 21 | 22 | if (attributeDescription == nil) 23 | { 24 | MRLogError( 25 | @"Invalid value for key '%@' in '%@' entity. Remove this key or add attribute '%@'\n", 26 | kMagicalRecordImportRelationshipLinkedByKey, 27 | self.name, 28 | lookupKey); 29 | } 30 | 31 | return attributeDescription; 32 | } 33 | 34 | - (NSManagedObject *) MR_createInstanceInContext:(NSManagedObjectContext *)context; 35 | { 36 | Class relatedClass = NSClassFromString([self managedObjectClassName]); 37 | NSManagedObject *newInstance = [relatedClass MR_createEntityInContext:context]; 38 | 39 | return newInstance; 40 | } 41 | 42 | - (NSAttributeDescription *) MR_attributeDescriptionForName:(NSString *)name; 43 | { 44 | __block NSAttributeDescription *attributeDescription; 45 | 46 | NSDictionary *attributesByName = [self attributesByName]; 47 | 48 | if ([attributesByName count] == 0) { 49 | return nil; 50 | } 51 | 52 | [attributesByName enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 53 | if ([key isEqualToString:name]) { 54 | attributeDescription = obj; 55 | 56 | *stop = YES; 57 | } 58 | }]; 59 | 60 | return attributeDescription; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSNumber+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface NSNumber (MagicalRecord_DataImport) 14 | 15 | - (MR_nullable NSString *)MR_lookupKeyForAttribute:(MR_nonnull NSAttributeDescription *)attributeInfo; 16 | - (MR_nonnull id)MR_relatedValueForRelationship:(MR_nonnull NSRelationshipDescription *)relationshipInfo; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSNumber+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSNumber+MagicalDataImport.h" 10 | 11 | @implementation NSNumber (MagicalRecord_DataImport) 12 | 13 | - (NSString *)MR_lookupKeyForAttribute:(NSAttributeDescription *)attributeInfo 14 | { 15 | return nil; 16 | } 17 | 18 | - (id)MR_relatedValueForRelationship:(NSRelationshipDescription *)relationshipInfo 19 | { 20 | return self; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface NSObject (MagicalRecord_DataImport) 14 | 15 | - (MR_nullable NSString *) MR_lookupKeyForAttribute:(MR_nonnull NSAttributeDescription *)attributeInfo; 16 | - (MR_nullable id) MR_valueForAttribute:(MR_nonnull NSAttributeDescription *)attributeInfo; 17 | 18 | - (MR_nullable NSString *) MR_lookupKeyForRelationship:(MR_nonnull NSRelationshipDescription *)relationshipInfo; 19 | - (MR_nullable id) MR_relatedValueForRelationship:(MR_nonnull NSRelationshipDescription *)relationshipInfo; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSObject+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MagicalDataImport.h" 10 | #import "NSAttributeDescription+MagicalDataImport.h" 11 | #import "NSEntityDescription+MagicalDataImport.h" 12 | #import "NSManagedObject+MagicalDataImport.h" 13 | #import "NSRelationshipDescription+MagicalDataImport.h" 14 | #import "MagicalRecordLogging.h" 15 | 16 | NSUInteger const kMagicalRecordImportMaximumAttributeFailoverDepth = 10; 17 | 18 | 19 | @implementation NSObject (MagicalRecord_DataImport) 20 | 21 | - (NSString *) MR_lookupKeyForAttribute:(NSAttributeDescription *)attributeInfo; 22 | { 23 | NSString *attributeName = [attributeInfo name]; 24 | NSString *lookupKey = [[attributeInfo userInfo] objectForKey:kMagicalRecordImportAttributeKeyMapKey] ?: attributeName; 25 | 26 | id value = [self valueForKeyPath:lookupKey]; 27 | 28 | for (NSUInteger i = 1; i < kMagicalRecordImportMaximumAttributeFailoverDepth && value == nil; i++) 29 | { 30 | attributeName = [NSString stringWithFormat:@"%@.%lu", kMagicalRecordImportAttributeKeyMapKey, (unsigned long)i]; 31 | lookupKey = [[attributeInfo userInfo] objectForKey:attributeName]; 32 | if (lookupKey == nil) 33 | { 34 | return nil; 35 | } 36 | value = [self valueForKeyPath:lookupKey]; 37 | } 38 | 39 | return value != nil ? lookupKey : nil; 40 | } 41 | 42 | - (id) MR_valueForAttribute:(NSAttributeDescription *)attributeInfo 43 | { 44 | NSString *lookupKey = [self MR_lookupKeyForAttribute:attributeInfo]; 45 | return lookupKey ? [self valueForKeyPath:lookupKey] : nil; 46 | } 47 | 48 | - (NSString *) MR_lookupKeyForRelationship:(NSRelationshipDescription *)relationshipInfo 49 | { 50 | NSEntityDescription *destinationEntity = [relationshipInfo destinationEntity]; 51 | if (destinationEntity == nil) 52 | { 53 | MRLogError(@"Unable to find entity for type '%@'", [self valueForKey:kMagicalRecordImportRelationshipTypeKey]); 54 | return nil; 55 | } 56 | 57 | NSString *primaryKeyName = [relationshipInfo MR_primaryKey]; 58 | NSAttributeDescription *primaryKeyAttribute = [destinationEntity MR_attributeDescriptionForName:primaryKeyName]; 59 | NSString *lookupKey = [self MR_lookupKeyForAttribute:primaryKeyAttribute] ?: [primaryKeyAttribute name]; 60 | 61 | return lookupKey; 62 | } 63 | 64 | - (id) MR_relatedValueForRelationship:(NSRelationshipDescription *)relationshipInfo 65 | { 66 | NSString *lookupKey = [self MR_lookupKeyForRelationship:relationshipInfo]; 67 | return lookupKey ? [self valueForKeyPath:lookupKey] : nil; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSRelationshipDescription+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSRelationshipDescription+MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSRelationshipDescription (MagicalRecord_DataImport) 13 | 14 | - (MR_nonnull NSString *) MR_primaryKey; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSRelationshipDescription+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSRelationshipDescription+MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 9/4/11. 6 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSRelationshipDescription+MagicalDataImport.h" 10 | #import "NSManagedObject+MagicalDataImport.h" 11 | #import "MagicalImportFunctions.h" 12 | 13 | @implementation NSRelationshipDescription (MagicalRecord_DataImport) 14 | 15 | - (NSString *) MR_primaryKey; 16 | { 17 | NSString *primaryKeyName = [[self userInfo] objectForKey:kMagicalRecordImportRelationshipLinkedByKey] ?: 18 | MR_primaryKeyNameFromString([[self destinationEntity] name]); 19 | 20 | return primaryKeyName; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSString+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MagicalRecord_MagicalDataImport.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 12/10/11. 6 | // Copyright (c) 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface NSString (MagicalRecord_DataImport) 14 | 15 | - (MR_nonnull NSString *) MR_capitalizedFirstCharacterString; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/DataImport/NSString+MagicalDataImport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MagicalRecord_MagicalDataImport.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 12/10/11. 6 | // Copyright (c) 2011 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSString+MagicalDataImport.h" 10 | 11 | 12 | @implementation NSString (MagicalRecord_DataImport) 13 | 14 | - (NSString *) MR_capitalizedFirstCharacterString; 15 | { 16 | if ([self length] > 0) 17 | { 18 | NSString *firstChar = [[self substringToIndex:1] capitalizedString]; 19 | return [firstChar stringByAppendingString:[self substringFromIndex:1]]; 20 | } 21 | return self; 22 | } 23 | 24 | - (id) MR_relatedValueForRelationship:(NSRelationshipDescription *)relationshipInfo 25 | { 26 | return self; 27 | } 28 | 29 | - (NSString *) MR_lookupKeyForAttribute:(NSAttributeDescription *)attributeInfo 30 | { 31 | return nil; 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalAggregation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObject+MagicalAggregation.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSManagedObject (MagicalAggregation) 13 | 14 | + (MR_nonnull NSNumber *) MR_numberOfEntities; 15 | + (MR_nonnull NSNumber *) MR_numberOfEntitiesWithContext:(MR_nonnull NSManagedObjectContext *)context; 16 | + (MR_nonnull NSNumber *) MR_numberOfEntitiesWithPredicate:(MR_nullable NSPredicate *)searchTerm; 17 | + (MR_nonnull NSNumber *) MR_numberOfEntitiesWithPredicate:(MR_nullable NSPredicate *)searchTerm inContext:(MR_nonnull NSManagedObjectContext *)context; 18 | 19 | + (NSUInteger) MR_countOfEntities; 20 | + (NSUInteger) MR_countOfEntitiesWithContext:(MR_nonnull NSManagedObjectContext *)context; 21 | + (NSUInteger) MR_countOfEntitiesWithPredicate:(MR_nullable NSPredicate *)searchFilter; 22 | + (NSUInteger) MR_countOfEntitiesWithPredicate:(MR_nullable NSPredicate *)searchFilter inContext:(MR_nonnull NSManagedObjectContext *)context; 23 | 24 | + (BOOL) MR_hasAtLeastOneEntity; 25 | + (BOOL) MR_hasAtLeastOneEntityInContext:(MR_nonnull NSManagedObjectContext *)context; 26 | 27 | - (MR_nullable id) MR_minValueFor:(MR_nonnull NSString *)property; 28 | - (MR_nullable id) MR_maxValueFor:(MR_nonnull NSString *)property; 29 | 30 | + (MR_nullable id) MR_aggregateOperation:(MR_nonnull NSString *)function onAttribute:(MR_nonnull NSString *)attributeName withPredicate:(MR_nullable NSPredicate *)predicate inContext:(MR_nonnull NSManagedObjectContext *)context; 31 | + (MR_nullable id) MR_aggregateOperation:(MR_nonnull NSString *)function onAttribute:(MR_nonnull NSString *)attributeName withPredicate:(MR_nullable NSPredicate *)predicate; 32 | 33 | /** 34 | * Supports aggregating values using a key-value collection operator that can be grouped by an attribute. 35 | * See https://developer.apple.com/library/ios/documentation/cocoa/conceptual/KeyValueCoding/Articles/CollectionOperators.html for a list of valid collection operators. 36 | * 37 | * @since 2.3.0 38 | * 39 | * @param collectionOperator Collection operator 40 | * @param attributeName Entity attribute to apply the collection operator to 41 | * @param predicate Predicate to filter results 42 | * @param groupingKeyPath Key path to group results by 43 | * @param context Context to perform the request in 44 | * 45 | * @return Results of the collection operator, filtered by the provided predicate and grouped by the provided key path 46 | */ 47 | + (MR_nullable NSArray *) MR_aggregateOperation:(MR_nonnull NSString *)collectionOperator onAttribute:(MR_nonnull NSString *)attributeName withPredicate:(MR_nullable NSPredicate *)predicate groupBy:(MR_nullable NSString*)groupingKeyPath inContext:(MR_nonnull NSManagedObjectContext *)context; 48 | 49 | /** 50 | * Supports aggregating values using a key-value collection operator that can be grouped by an attribute. 51 | * See https://developer.apple.com/library/ios/documentation/cocoa/conceptual/KeyValueCoding/Articles/CollectionOperators.html for a list of valid collection operators. 52 | * 53 | * This method is run against the default MagicalRecordStack's context. 54 | * 55 | * @since 2.3.0 56 | * 57 | * @param collectionOperator Collection operator 58 | * @param attributeName Entity attribute to apply the collection operator to 59 | * @param predicate Predicate to filter results 60 | * @param groupingKeyPath Key path to group results by 61 | * 62 | * @return Results of the collection operator, filtered by the provided predicate and grouped by the provided key path 63 | */ 64 | + (MR_nullable NSArray *) MR_aggregateOperation:(MR_nonnull NSString *)collectionOperator onAttribute:(MR_nonnull NSString *)attributeName withPredicate:(MR_nullable NSPredicate *)predicate groupBy:(MR_nullable NSString*)groupingKeyPath; 65 | 66 | - (MR_nullable instancetype) MR_objectWithMinValueFor:(MR_nonnull NSString *)property; 67 | - (MR_nullable instancetype) MR_objectWithMinValueFor:(MR_nonnull NSString *)property inContext:(MR_nonnull NSManagedObjectContext *)context; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalDataImport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObject+JSONHelpers.h 3 | // 4 | // Created by Saul Mora on 6/28/11. 5 | // Copyright 2011 Magical Panda Software LLC. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportCustomDateFormatKey; 12 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportDefaultDateFormatString; 13 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportUnixTimeString; 14 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportAttributeKeyMapKey; 15 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportAttributeValueClassNameKey; 16 | 17 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportRelationshipMapKey; 18 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportRelationshipLinkedByKey; 19 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordImportRelationshipTypeKey; 20 | 21 | @protocol MagicalRecordDataImportProtocol 22 | 23 | @optional 24 | - (BOOL) shouldImport:(MR_nonnull id)data; 25 | - (void) willImport:(MR_nonnull id)data; 26 | - (void) didImport:(MR_nonnull id)data; 27 | 28 | @end 29 | 30 | @interface NSManagedObject (MagicalRecord_DataImport) 31 | 32 | - (BOOL) MR_importValuesForKeysWithObject:(MR_nonnull id)objectData; 33 | 34 | + (MR_nonnull instancetype) MR_importFromObject:(MR_nonnull id)data; 35 | + (MR_nonnull instancetype) MR_importFromObject:(MR_nonnull id)data inContext:(MR_nonnull NSManagedObjectContext *)context; 36 | 37 | + (MR_nonnull MR_NSArrayOfNSManagedObjects) MR_importFromArray:(MR_nonnull MR_GENERIC(NSArray, NSDictionary *) *)listOfObjectData; 38 | + (MR_nonnull MR_NSArrayOfNSManagedObjects) MR_importFromArray:(MR_nonnull MR_GENERIC(NSArray, NSDictionary *) *)listOfObjectData inContext:(MR_nonnull NSManagedObjectContext *)context; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // Created by Saul Mora on 11/15/09. 4 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | #import 10 | 11 | @interface NSManagedObject (MagicalRecord) 12 | 13 | /** 14 | * If the NSManagedObject subclass calling this method has implemented the `entityName` method, then the return value of that will be used. 15 | * If `entityName` is not implemented, then the name of the class is returned. If the class is written in Swift, the module name will be removed. 16 | * 17 | * @return String based name for the entity 18 | */ 19 | + (MR_nonnull NSString *) MR_entityName; 20 | 21 | + (NSUInteger) MR_defaultBatchSize; 22 | + (void) MR_setDefaultBatchSize:(NSUInteger)newBatchSize; 23 | 24 | + (MR_nullable MR_NSArrayOfNSManagedObjects) MR_executeFetchRequest:(MR_nonnull NSFetchRequest *)request; 25 | + (MR_nullable MR_NSArrayOfNSManagedObjects) MR_executeFetchRequest:(MR_nonnull NSFetchRequest *)request inContext:(MR_nonnull NSManagedObjectContext *)context; 26 | + (MR_nullable instancetype) MR_executeFetchRequestAndReturnFirstObject:(MR_nonnull NSFetchRequest *)request; 27 | + (MR_nullable instancetype) MR_executeFetchRequestAndReturnFirstObject:(MR_nonnull NSFetchRequest *)request inContext:(MR_nonnull NSManagedObjectContext *)context; 28 | 29 | #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR 30 | 31 | + (BOOL) MR_performFetch:(MR_nonnull NSFetchedResultsController *)controller; 32 | 33 | #endif 34 | 35 | + (MR_nullable NSEntityDescription *) MR_entityDescription; 36 | + (MR_nullable NSEntityDescription *) MR_entityDescriptionInContext:(MR_nonnull NSManagedObjectContext *)context; 37 | + (MR_nullable MR_GENERIC(NSArray, NSPropertyDescription *) *) MR_propertiesNamed:(MR_nonnull MR_GENERIC(NSArray, NSString *) *)properties; 38 | + (MR_nullable MR_GENERIC(NSArray, NSPropertyDescription *) *) MR_propertiesNamed:(MR_nonnull MR_GENERIC(NSArray, NSString *) *)properties inContext:(MR_nonnull NSManagedObjectContext *)context; 39 | 40 | + (MR_nullable instancetype) MR_createEntity; 41 | + (MR_nullable instancetype) MR_createEntityInContext:(MR_nonnull NSManagedObjectContext *)context; 42 | 43 | - (BOOL) MR_deleteEntity; 44 | - (BOOL) MR_deleteEntityInContext:(MR_nonnull NSManagedObjectContext *)context; 45 | 46 | + (BOOL) MR_deleteAllMatchingPredicate:(MR_nonnull NSPredicate *)predicate; 47 | + (BOOL) MR_deleteAllMatchingPredicate:(MR_nonnull NSPredicate *)predicate inContext:(MR_nonnull NSManagedObjectContext *)context; 48 | 49 | + (BOOL) MR_truncateAll; 50 | + (BOOL) MR_truncateAllInContext:(MR_nonnull NSManagedObjectContext *)context; 51 | 52 | + (MR_nonnull MR_GENERIC(NSArray, NSSortDescriptor *) *) MR_ascendingSortDescriptors:(MR_nonnull MR_GENERIC(NSArray, NSString *) *)attributesToSortBy; 53 | + (MR_nonnull MR_GENERIC(NSArray, NSSortDescriptor *) *) MR_descendingSortDescriptors:(MR_nonnull MR_GENERIC(NSArray, NSString *) *)attributesToSortBy; 54 | 55 | - (MR_nullable instancetype) MR_inContext:(MR_nonnull NSManagedObjectContext *)otherContext; 56 | - (MR_nullable instancetype) MR_inThreadContext; 57 | 58 | @end 59 | 60 | @protocol MagicalRecord_MOGenerator 61 | 62 | @optional 63 | + (MR_nonnull NSString *)entityName; 64 | - (MR_nullable instancetype) entityInManagedObjectContext:(MR_nonnull NSManagedObjectContext *)object; 65 | - (MR_nullable instancetype) insertInManagedObjectContext:(MR_nonnull NSManagedObjectContext *)object; 66 | 67 | @end 68 | 69 | #pragma mark - Deprecated Methods — DO NOT USE 70 | @interface NSManagedObject (MagicalRecordDeprecated) 71 | 72 | + (MR_nullable instancetype) MR_createInContext:(MR_nonnull NSManagedObjectContext *)context MR_DEPRECATED_WILL_BE_REMOVED_IN_PLEASE_USE("4.0", "MR_createEntityInContext:"); 73 | - (BOOL) MR_deleteInContext:(MR_nonnull NSManagedObjectContext *)context MR_DEPRECATED_WILL_BE_REMOVED_IN_PLEASE_USE("4.0", "MR_deleteEntityInContext:"); 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRequests.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObject+MagicalRequests.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSManagedObject (MagicalRequests) 13 | 14 | + (MR_nonnull NSFetchRequest *) MR_createFetchRequest; 15 | + (MR_nonnull NSFetchRequest *) MR_createFetchRequestInContext:(MR_nonnull NSManagedObjectContext *)context; 16 | 17 | + (MR_nonnull NSFetchRequest *) MR_requestAll; 18 | + (MR_nonnull NSFetchRequest *) MR_requestAllInContext:(MR_nonnull NSManagedObjectContext *)context; 19 | + (MR_nonnull NSFetchRequest *) MR_requestAllWithPredicate:(MR_nullable NSPredicate *)searchTerm; 20 | + (MR_nonnull NSFetchRequest *) MR_requestAllWithPredicate:(MR_nullable NSPredicate *)searchTerm inContext:(MR_nonnull NSManagedObjectContext *)context; 21 | + (MR_nonnull NSFetchRequest *) MR_requestAllWhere:(MR_nonnull NSString *)property isEqualTo:(MR_nonnull id)value; 22 | + (MR_nonnull NSFetchRequest *) MR_requestAllWhere:(MR_nonnull NSString *)property isEqualTo:(MR_nonnull id)value inContext:(MR_nonnull NSManagedObjectContext *)context; 23 | + (MR_nonnull NSFetchRequest *) MR_requestFirstWithPredicate:(MR_nullable NSPredicate *)searchTerm; 24 | + (MR_nonnull NSFetchRequest *) MR_requestFirstWithPredicate:(MR_nullable NSPredicate *)searchTerm inContext:(MR_nonnull NSManagedObjectContext *)context; 25 | + (MR_nonnull NSFetchRequest *) MR_requestFirstByAttribute:(MR_nonnull NSString *)attribute withValue:(MR_nullable id)searchValue; 26 | + (MR_nonnull NSFetchRequest *) MR_requestFirstByAttribute:(MR_nonnull NSString *)attribute withValue:(MR_nullable id)searchValue inContext:(MR_nonnull NSManagedObjectContext *)context; 27 | + (MR_nonnull NSFetchRequest *) MR_requestAllSortedBy:(MR_nonnull NSString *)sortTerm ascending:(BOOL)ascending; 28 | + (MR_nonnull NSFetchRequest *) MR_requestAllSortedBy:(MR_nonnull NSString *)sortTerm ascending:(BOOL)ascending inContext:(MR_nonnull NSManagedObjectContext *)context; 29 | + (MR_nonnull NSFetchRequest *) MR_requestAllSortedBy:(MR_nonnull NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(MR_nullable NSPredicate *)searchTerm; 30 | + (MR_nonnull NSFetchRequest *) MR_requestAllSortedBy:(MR_nonnull NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(MR_nullable NSPredicate *)searchTerm inContext:(MR_nonnull NSManagedObjectContext *)context; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalChainSave.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalChainSave.h 3 | // Magical Record 4 | // 5 | // Created by Lee on 8/27/14. 6 | // Copyright (c) 2014 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface NSManagedObjectContext (MagicalRecordChainSave) 14 | /** 15 | Creates a child context for the current context that you can make changes within, before saving up through all parent contexts to the main queue context, and finally to the saving context. This method will return immediately, and execute the save initially on a background thread, and then on the appropriate thread for each context it saves. 16 | 17 | @param block Block that is passed a managed object context. 18 | */ 19 | - (void)MR_saveWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block; 20 | 21 | /** 22 | Creates a child context for the current context that you can make changes within, before saving up through all parent contexts to the main queue context, and finally to the saving context. This method will return immediately, and execute the save initially on a background thread, and then on the appropriate thread for each context it saves. 23 | 24 | @param block Block that is passed a managed object context. 25 | @param completion Completion block that is called once all contexts have been saved, or if an error is encountered. 26 | */ 27 | - (void)MR_saveWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block completion:(MR_nullable MRSaveCompletionHandler)completion; 28 | 29 | /** 30 | Creates a child context for the current context that you can make changes within, before saving up through all parent contexts to the main queue context, and finally to the saving context. This method will not return until the save has completed, blocking the thread it is called on. 31 | 32 | @param block Block that is passed a managed object context. 33 | */ 34 | - (void)MR_saveWithBlockAndWait:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalChainSave.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalChainSave.m 3 | // Magical Record 4 | // 5 | // Created by Lee on 8/27/14. 6 | // Copyright (c) 2014 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSManagedObjectContext+MagicalChainSave.h" 10 | #import "NSManagedObjectContext+MagicalRecord.h" 11 | 12 | @implementation NSManagedObjectContext (MagicalRecord_ChainSave) 13 | - (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block; 14 | { 15 | [self MR_saveWithBlock:block completion:nil]; 16 | } 17 | 18 | - (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block completion:(MRSaveCompletionHandler)completion; 19 | { 20 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:self]; 21 | 22 | [localContext performBlock:^{ 23 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 24 | 25 | if (block) { 26 | block(localContext); 27 | } 28 | 29 | [localContext MR_saveWithOptions:MRSaveParentContexts completion:completion]; 30 | }]; 31 | } 32 | 33 | #pragma mark - Synchronous saving 34 | 35 | - (void)MR_saveWithBlockAndWait:(void (^)(NSManagedObjectContext *localContext))block; 36 | { 37 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:self]; 38 | 39 | [localContext performBlockAndWait:^{ 40 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 41 | 42 | if (block) { 43 | block(localContext); 44 | } 45 | 46 | [localContext MR_saveWithOptions:MRSaveParentContexts|MRSaveSynchronously completion:nil]; 47 | }]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalObserving.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalObserving.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/9/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordDidMergeChangesFromiCloudNotification; 13 | 14 | /** 15 | Category methods to aid in observing changes in other contexts. 16 | 17 | @since Available in v2.0 and later. 18 | */ 19 | @interface NSManagedObjectContext (MagicalObserving) 20 | 21 | /** 22 | Merge changes from another context into self. 23 | 24 | @param otherContext Managed object context to observe. 25 | 26 | @since Available in v2.0 and later. 27 | */ 28 | - (void) MR_observeContext:(MR_nonnull NSManagedObjectContext *)otherContext; 29 | 30 | /** 31 | Stops merging changes from the supplied context into self. 32 | 33 | @param otherContext Managed object context to stop observing. 34 | 35 | @since Available in v2.0 and later. 36 | */ 37 | - (void) MR_stopObservingContext:(MR_nonnull NSManagedObjectContext *)otherContext; 38 | 39 | /** 40 | Merges changes from another context into self on the main thread. 41 | 42 | @param otherContext Managed object context to observe. 43 | 44 | @since Available in v2.0 and later. 45 | */ 46 | - (void) MR_observeContextOnMainThread:(MR_nonnull NSManagedObjectContext *)otherContext; 47 | 48 | /** 49 | Merges changes from the supplied persistent store coordinator into self in response to changes from iCloud. 50 | 51 | @param coordinator Persistent store coordinator 52 | 53 | @see -MR_stopObservingiCloudChangesInCoordinator: 54 | 55 | @since Available in v2.0 and later. 56 | */ 57 | - (void) MR_observeiCloudChangesInCoordinator:(MR_nonnull NSPersistentStoreCoordinator *)coordinator; 58 | 59 | /** 60 | Stops observation and merging of changes from the supplied persistent store coordinator in response to changes from iCloud. 61 | 62 | @param coordinator Persistent store coordinator 63 | 64 | @see -MR_observeiCloudChangesInCoordinator: 65 | 66 | @since Available in v2.0 and later. 67 | */ 68 | - (void) MR_stopObservingiCloudChangesInCoordinator:(MR_nonnull NSPersistentStoreCoordinator *)coordinator; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalObserving.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalObserving.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/9/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSManagedObjectContext+MagicalObserving.h" 10 | #import "NSManagedObjectContext+MagicalRecord.h" 11 | #import "MagicalRecord+iCloud.h" 12 | #import "MagicalRecordLogging.h" 13 | 14 | NSString * const kMagicalRecordDidMergeChangesFromiCloudNotification = @"kMagicalRecordDidMergeChangesFromiCloudNotification"; 15 | 16 | @implementation NSManagedObjectContext (MagicalObserving) 17 | 18 | #pragma mark - Context Observation Helpers 19 | 20 | - (void) MR_observeContext:(NSManagedObjectContext *)otherContext 21 | { 22 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 23 | [notificationCenter addObserver:self 24 | selector:@selector(MR_mergeChangesFromNotification:) 25 | name:NSManagedObjectContextDidSaveNotification 26 | object:otherContext]; 27 | } 28 | 29 | - (void) MR_stopObservingContext:(NSManagedObjectContext *)otherContext 30 | { 31 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 32 | 33 | [notificationCenter removeObserver:self 34 | name:NSManagedObjectContextDidSaveNotification 35 | object:otherContext]; 36 | } 37 | 38 | - (void) MR_observeContextOnMainThread:(NSManagedObjectContext *)otherContext 39 | { 40 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 41 | [notificationCenter addObserver:self 42 | selector:@selector(MR_mergeChangesOnMainThread:) 43 | name:NSManagedObjectContextDidSaveNotification 44 | object:otherContext]; 45 | } 46 | 47 | #pragma mark - Context iCloud Merge Helpers 48 | 49 | - (void) MR_mergeChangesFromiCloud:(NSNotification *)notification; 50 | { 51 | [self performBlock:^{ 52 | 53 | MRLogVerbose(@"Merging changes From iCloud %@context%@", 54 | self == [NSManagedObjectContext MR_defaultContext] ? @"*** DEFAULT *** " : @"", 55 | ([NSThread isMainThread] ? @" *** on Main Thread ***" : @"")); 56 | 57 | [self mergeChangesFromContextDidSaveNotification:notification]; 58 | 59 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 60 | 61 | [notificationCenter postNotificationName:kMagicalRecordDidMergeChangesFromiCloudNotification 62 | object:self 63 | userInfo:[notification userInfo]]; 64 | }]; 65 | } 66 | 67 | - (void) MR_mergeChangesFromNotification:(NSNotification *)notification; 68 | { 69 | MRLogVerbose(@"Merging changes to %@context%@", 70 | self == [NSManagedObjectContext MR_defaultContext] ? @"*** DEFAULT *** " : @"", 71 | ([NSThread isMainThread] ? @" *** on Main Thread ***" : @"")); 72 | 73 | [self mergeChangesFromContextDidSaveNotification:notification]; 74 | } 75 | 76 | - (void) MR_mergeChangesOnMainThread:(NSNotification *)notification; 77 | { 78 | if ([NSThread isMainThread]) 79 | { 80 | [self MR_mergeChangesFromNotification:notification]; 81 | } 82 | else 83 | { 84 | [self performSelectorOnMainThread:@selector(MR_mergeChangesFromNotification:) withObject:notification waitUntilDone:YES]; 85 | } 86 | } 87 | 88 | - (void) MR_observeiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator; 89 | { 90 | if (![MagicalRecord isICloudEnabled]) return; 91 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 92 | [notificationCenter addObserver:self 93 | selector:@selector(MR_mergeChangesFromiCloud:) 94 | name:NSPersistentStoreDidImportUbiquitousContentChangesNotification 95 | object:coordinator]; 96 | 97 | } 98 | 99 | - (void) MR_stopObservingiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator; 100 | { 101 | if (![MagicalRecord isICloudEnabled]) return; 102 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 103 | [notificationCenter removeObserver:self 104 | name:NSPersistentStoreDidImportUbiquitousContentChangesNotification 105 | object:coordinator]; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalThreading.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalThreading.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/9/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSManagedObjectContext (MagicalThreading) 13 | 14 | + (MR_nonnull NSManagedObjectContext *) MR_contextForCurrentThread __attribute((deprecated("This method will be removed in MagicalRecord 3.0"))); 15 | + (void) MR_clearNonMainThreadContextsCache __attribute((deprecated("This method will be removed in MagicalRecord 3.0"))); 16 | + (void) MR_resetContextForCurrentThread __attribute((deprecated("This method will be removed in MagicalRecord 3.0"))); 17 | + (void) MR_clearContextForCurrentThread __attribute((deprecated("This method will be removed in MagicalRecord 3.0"))); 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalThreading.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectContext+MagicalThreading.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/9/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "NSManagedObjectContext+MagicalThreading.h" 10 | #import "NSManagedObjectContext+MagicalRecord.h" 11 | #import "NSManagedObject+MagicalRecord.h" 12 | #include 13 | 14 | static NSString const * kMagicalRecordManagedObjectContextKey = @"MagicalRecord_NSManagedObjectContextForThreadKey"; 15 | static NSString const * kMagicalRecordManagedObjectContextCacheVersionKey = @"MagicalRecord_CacheVersionOfNSManagedObjectContextForThreadKey"; 16 | static volatile int32_t contextsCacheVersion = 0; 17 | 18 | 19 | @implementation NSManagedObjectContext (MagicalThreading) 20 | 21 | + (void)MR_resetContextForCurrentThread 22 | { 23 | [[NSManagedObjectContext MR_contextForCurrentThread] reset]; 24 | } 25 | 26 | + (void) MR_clearNonMainThreadContextsCache 27 | { 28 | OSAtomicIncrement32(&contextsCacheVersion); 29 | } 30 | 31 | + (NSManagedObjectContext *) MR_contextForCurrentThread; 32 | { 33 | if ([NSThread isMainThread]) 34 | { 35 | return [self MR_defaultContext]; 36 | } 37 | else 38 | { 39 | // contextsCacheVersion can change (atomically) at any time, so grab a copy to ensure that we always 40 | // use the same value throughout the remainder of this method. We are OK with this method returning 41 | // an outdated context if MR_clearNonMainThreadContextsCache is called from another thread while this 42 | // method is being executed. This behavior is unrelated to our choice to use a counter for synchronization. 43 | // We would have the same behavior if we used @synchronized() (or any other lock-based synchronization 44 | // method) since MR_clearNonMainThreadContextsCache would have to wait until this method finished before 45 | // it could acquire the mutex, resulting in us still returning an outdated context in that case as well. 46 | int32_t targetCacheVersionForContext = contextsCacheVersion; 47 | 48 | NSMutableDictionary *threadDict = [[NSThread currentThread] threadDictionary]; 49 | NSManagedObjectContext *threadContext = [threadDict objectForKey:kMagicalRecordManagedObjectContextKey]; 50 | NSNumber *currentCacheVersionForContext = [threadDict objectForKey:kMagicalRecordManagedObjectContextCacheVersionKey]; 51 | NSAssert((threadContext && currentCacheVersionForContext) || (!threadContext && !currentCacheVersionForContext), 52 | @"The Magical Record keys should either both be present or neither be present, otherwise we're in an inconsistent state!"); 53 | if ((threadContext == nil) || (currentCacheVersionForContext == nil) || ((int32_t)[currentCacheVersionForContext integerValue] != targetCacheVersionForContext)) 54 | { 55 | threadContext = [self MR_contextWithParent:[NSManagedObjectContext MR_defaultContext]]; 56 | [threadDict setObject:threadContext forKey:kMagicalRecordManagedObjectContextKey]; 57 | [threadDict setObject:[NSNumber numberWithInteger:targetCacheVersionForContext] 58 | forKey:kMagicalRecordManagedObjectContextCacheVersionKey]; 59 | } 60 | return threadContext; 61 | } 62 | } 63 | 64 | + (void) MR_clearContextForCurrentThread { 65 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:kMagicalRecordManagedObjectContextKey]; 66 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:kMagicalRecordManagedObjectContextCacheVersionKey]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectModel+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectModel+MagicalRecord.h 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | @interface NSManagedObjectModel (MagicalRecord) 12 | 13 | + (MR_nullable NSManagedObjectModel *) MR_defaultManagedObjectModel; 14 | 15 | + (void) MR_setDefaultManagedObjectModel:(MR_nullable NSManagedObjectModel *)newDefaultModel; 16 | 17 | + (MR_nullable NSManagedObjectModel *) MR_mergedObjectModelFromMainBundle; 18 | + (MR_nullable NSManagedObjectModel *) MR_newManagedObjectModelNamed:(MR_nonnull NSString *)modelFileName NS_RETURNS_RETAINED; 19 | + (MR_nullable NSManagedObjectModel *) MR_managedObjectModelNamed:(MR_nonnull NSString *)modelFileName; 20 | + (MR_nullable NSManagedObjectModel *) MR_newModelNamed:(MR_nonnull NSString *) modelName inBundleNamed:(MR_nonnull NSString *) bundleName NS_RETURNS_RETAINED; 21 | + (MR_nullable NSManagedObjectModel *) MR_newModelNamed:(MR_nonnull NSString *) modelName inBundle:(MR_nonnull NSBundle*) bundle NS_RETURNS_RETAINED; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObjectModel+MagicalRecord.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSManagedObjectModel+MagicalRecord.m 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import "NSManagedObjectModel+MagicalRecord.h" 9 | #import "MagicalRecord+Options.h" 10 | 11 | static NSManagedObjectModel *defaultManagedObjectModel_ = nil; 12 | 13 | @implementation NSManagedObjectModel (MagicalRecord) 14 | 15 | + (NSManagedObjectModel *) MR_defaultManagedObjectModel 16 | { 17 | if (defaultManagedObjectModel_ == nil && [MagicalRecord shouldAutoCreateManagedObjectModel]) 18 | { 19 | [self MR_setDefaultManagedObjectModel:[self MR_mergedObjectModelFromMainBundle]]; 20 | } 21 | return defaultManagedObjectModel_; 22 | } 23 | 24 | + (void) MR_setDefaultManagedObjectModel:(NSManagedObjectModel *)newDefaultModel 25 | { 26 | defaultManagedObjectModel_ = newDefaultModel; 27 | } 28 | 29 | + (NSManagedObjectModel *) MR_mergedObjectModelFromMainBundle; 30 | { 31 | return [self mergedModelFromBundles:nil]; 32 | } 33 | 34 | + (NSManagedObjectModel *) MR_newModelNamed:(NSString *) modelName inBundleNamed:(NSString *) bundleName 35 | { 36 | NSString *path = [[NSBundle mainBundle] pathForResource:[modelName stringByDeletingPathExtension] 37 | ofType:[modelName pathExtension] 38 | inDirectory:bundleName]; 39 | NSURL *modelUrl = [NSURL fileURLWithPath:path]; 40 | 41 | NSManagedObjectModel *mom = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelUrl]; 42 | 43 | return mom; 44 | } 45 | 46 | + (NSManagedObjectModel *) MR_newModelNamed:(NSString *) modelName inBundle:(NSBundle*) bundle 47 | { 48 | NSString *path = [bundle pathForResource:[modelName stringByDeletingPathExtension] 49 | ofType:[modelName pathExtension]]; 50 | NSURL *modelUrl = [NSURL fileURLWithPath:path]; 51 | 52 | NSManagedObjectModel *mom = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelUrl]; 53 | 54 | return mom; 55 | } 56 | 57 | + (NSManagedObjectModel *) MR_newManagedObjectModelNamed:(NSString *)modelFileName 58 | { 59 | NSString *path = [[NSBundle mainBundle] pathForResource:[modelFileName stringByDeletingPathExtension] 60 | ofType:[modelFileName pathExtension]]; 61 | NSURL *momURL = [NSURL fileURLWithPath:path]; 62 | 63 | NSManagedObjectModel *model = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL]; 64 | return model; 65 | } 66 | 67 | + (NSManagedObjectModel *) MR_managedObjectModelNamed:(NSString *)modelFileName 68 | { 69 | NSManagedObjectModel *model = [self MR_newManagedObjectModelNamed:modelFileName]; 70 | return model; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSPersistentStore+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSPersistentStore+MagicalRecord.h 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import "MagicalRecordDeprecationMacros.h" 11 | 12 | // option to autodelete store if it already exists 13 | 14 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordDefaultStoreFileName; 15 | 16 | 17 | @interface NSPersistentStore (MagicalRecord) 18 | 19 | + (MR_nonnull NSURL *) MR_defaultLocalStoreUrl; 20 | 21 | + (MR_nullable NSPersistentStore *) MR_defaultPersistentStore; 22 | + (void) MR_setDefaultPersistentStore:(MR_nullable NSPersistentStore *) store; 23 | 24 | + (MR_nullable NSURL *) MR_urlForStoreName:(MR_nonnull NSString *)storeFileName; 25 | + (MR_nullable NSURL *) MR_cloudURLForUbiquitousContainer:(MR_nonnull NSString *)bucketName; 26 | + (MR_nullable NSURL *) MR_cloudURLForUbiqutiousContainer:(MR_nonnull NSString *)bucketName MR_DEPRECATED_WILL_BE_REMOVED_IN_PLEASE_USE("4.0", "MR_cloudURLForUbiquitousContainer:"); 27 | 28 | @end 29 | 30 | 31 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSPersistentStore+MagicalRecord.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPersistentStore+MagicalRecord.m 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import "NSPersistentStore+MagicalRecord.h" 9 | 10 | NSString * const kMagicalRecordDefaultStoreFileName = @"CoreDataStore.sqlite"; 11 | 12 | static NSPersistentStore *defaultPersistentStore_ = nil; 13 | 14 | 15 | @implementation NSPersistentStore (MagicalRecord) 16 | 17 | + (NSPersistentStore *) MR_defaultPersistentStore 18 | { 19 | return defaultPersistentStore_; 20 | } 21 | 22 | + (void) MR_setDefaultPersistentStore:(NSPersistentStore *)store 23 | { 24 | defaultPersistentStore_ = store; 25 | } 26 | 27 | + (NSString *) MR_directory:(NSSearchPathDirectory)type 28 | { 29 | return [NSSearchPathForDirectoriesInDomains(type, NSUserDomainMask, YES) lastObject]; 30 | } 31 | 32 | + (NSString *)MR_applicationDocumentsDirectory 33 | { 34 | return [self MR_directory:NSDocumentDirectory]; 35 | } 36 | 37 | + (NSString *)MR_applicationStorageDirectory 38 | { 39 | NSString *applicationName = [[[NSBundle mainBundle] infoDictionary] valueForKey:(NSString *)kCFBundleNameKey]; 40 | return [[self MR_directory:NSApplicationSupportDirectory] stringByAppendingPathComponent:applicationName]; 41 | } 42 | 43 | + (NSURL *) MR_urlForStoreName:(NSString *)storeFileName 44 | { 45 | NSString *pathForStoreName = [[self MR_applicationStorageDirectory] stringByAppendingPathComponent:storeFileName]; 46 | return [NSURL fileURLWithPath:pathForStoreName]; 47 | } 48 | 49 | + (NSURL *) MR_cloudURLForUbiquitousContainer:(NSString *)bucketName; 50 | { 51 | NSFileManager *fileManager = [[NSFileManager alloc] init]; 52 | NSURL *cloudURL = nil; 53 | if ([fileManager respondsToSelector:@selector(URLForUbiquityContainerIdentifier:)]) 54 | { 55 | cloudURL = [fileManager URLForUbiquityContainerIdentifier:bucketName]; 56 | } 57 | 58 | return cloudURL; 59 | } 60 | 61 | + (NSURL *) MR_cloudURLForUbiqutiousContainer:(NSString *)bucketName; 62 | { 63 | return [self MR_cloudURLForUbiquitousContainer:bucketName]; 64 | } 65 | 66 | + (NSURL *) MR_defaultLocalStoreUrl 67 | { 68 | return [self MR_urlForStoreName:kMagicalRecordDefaultStoreFileName]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Categories/NSPersistentStoreCoordinator+MagicalRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSPersistentStoreCoordinator+MagicalRecord.h 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCDidCompleteiCloudSetupNotification; 12 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchWillDeleteStore; 13 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchDidDeleteStore; 14 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchWillRecreateStore; 15 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchDidRecreateStore; 16 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchCouldNotDeleteStore; 17 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordPSCMismatchCouldNotRecreateStore; 18 | 19 | @interface NSPersistentStoreCoordinator (MagicalRecord) 20 | 21 | + (MR_nullable NSPersistentStoreCoordinator *) MR_defaultStoreCoordinator; 22 | + (void) MR_setDefaultStoreCoordinator:(MR_nullable NSPersistentStoreCoordinator *)coordinator; 23 | 24 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithInMemoryStore; 25 | 26 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_newPersistentStoreCoordinator NS_RETURNS_RETAINED; 27 | 28 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithSqliteStoreNamed:(MR_nonnull NSString *)storeFileName; 29 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithAutoMigratingSqliteStoreNamed:(MR_nonnull NSString *)storeFileName; 30 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithSqliteStoreAtURL:(MR_nonnull NSURL *)storeURL; 31 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithAutoMigratingSqliteStoreAtURL:(MR_nonnull NSURL *)storeURL; 32 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithPersistentStore:(MR_nonnull NSPersistentStore *)persistentStore; 33 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreNamed:(MR_nonnull NSString *)localStoreName cloudStorePathComponent:(MR_nullable NSString *)subPathComponent; 34 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreAtURL:(MR_nonnull NSURL *)storeURL cloudStorePathComponent:(MR_nullable NSString *)subPathComponent; 35 | 36 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreNamed:(MR_nonnull NSString *)localStoreName cloudStorePathComponent:(MR_nullable NSString *)subPathComponent completion:(void (^ __MR_nullable)(void))completionHandler; 37 | + (MR_nonnull NSPersistentStoreCoordinator *) MR_coordinatorWithiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreAtURL:(MR_nonnull NSURL *)storeURL cloudStorePathComponent:(MR_nullable NSString *)subPathComponent completion:(void (^ __MR_nullable)(void))completionHandler; 38 | 39 | - (MR_nullable NSPersistentStore *) MR_addInMemoryStore; 40 | - (MR_nullable NSPersistentStore *) MR_addAutoMigratingSqliteStoreNamed:(MR_nonnull NSString *) storeFileName; 41 | - (MR_nullable NSPersistentStore *) MR_addAutoMigratingSqliteStoreAtURL:(MR_nonnull NSURL *)storeURL; 42 | 43 | - (MR_nullable NSPersistentStore *) MR_addSqliteStoreNamed:(MR_nonnull id)storeFileName withOptions:(MR_nullable __autoreleasing NSDictionary *)options; 44 | - (MR_nullable NSPersistentStore *) MR_addSqliteStoreNamed:(MR_nonnull id)storeFileName configuration:(MR_nullable NSString *)configuration withOptions:(MR_nullable __autoreleasing NSDictionary *)options; 45 | 46 | - (void) MR_addiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreNamed:(MR_nonnull NSString *)localStoreName cloudStorePathComponent:(MR_nullable NSString *)subPathComponent; 47 | - (void) MR_addiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreAtURL:(MR_nonnull NSURL *)storeURL cloudStorePathComponent:(MR_nullable NSString *)subPathComponent; 48 | - (void) MR_addiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreNamed:(MR_nonnull NSString *)localStoreName cloudStorePathComponent:(MR_nullable NSString *)subPathComponent completion:(void (^ __MR_nullable)(void))completionBlock; 49 | - (void) MR_addiCloudContainerID:(MR_nonnull NSString *)containerID contentNameKey:(MR_nullable NSString *)contentNameKey localStoreAtURL:(MR_nonnull NSURL *)storeURL cloudStorePathComponent:(MR_nullable NSString *)subPathComponent completion:(void (^ __MR_nullable)(void))completionBlock; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+Actions.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+Actions.h 3 | // 4 | // Created by Saul Mora on 2/24/11. 5 | // Copyright 2011 Magical Panda Software. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | @interface MagicalRecord (Actions) 15 | 16 | /* For all background saving operations. These calls will be sent to a different thread/queue. 17 | */ 18 | + (void) saveWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block; 19 | + (void) saveWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block completion:(MR_nullable MRSaveCompletionHandler)completion; 20 | 21 | /* For saving on the current thread as the caller, only with a separate context. Useful when you're managing your own threads/queues and need a serial call to create or change data 22 | */ 23 | + (void) saveWithBlockAndWait:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block; 24 | 25 | @end 26 | 27 | @interface MagicalRecord (ActionsDeprecated) 28 | 29 | + (void) saveUsingCurrentThreadContextWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block completion:(MR_nullable MRSaveCompletionHandler)completion MR_DEPRECATED_WILL_BE_REMOVED_IN("3.0"); 30 | + (void) saveUsingCurrentThreadContextWithBlockAndWait:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block MR_DEPRECATED_WILL_BE_REMOVED_IN("3.0"); 31 | + (void) saveInBackgroundWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block MR_DEPRECATED_WILL_BE_REMOVED_IN("3.0"); 32 | + (void) saveInBackgroundWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block completion:(void (^ __MR_nullable)(void))completion MR_DEPRECATED_WILL_BE_REMOVED_IN("3.0"); 33 | + (void) saveInBackgroundUsingCurrentContextWithBlock:(void (^ __MR_nonnull)(NSManagedObjectContext * __MR_nonnull localContext))block completion:(void (^ __MR_nullable)(void))completion errorHandler:(void (^ __MR_nullable)(NSError * __MR_nullable error))errorHandler MR_DEPRECATED_WILL_BE_REMOVED_IN("3.0"); 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+Actions.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+Actions.m 3 | // 4 | // Created by Saul Mora on 2/24/11. 5 | // Copyright 2011 Magical Panda Software. All rights reserved. 6 | // 7 | 8 | #import "MagicalRecord+Actions.h" 9 | #import "NSManagedObjectContext+MagicalRecord.h" 10 | #import "NSManagedObjectContext+MagicalThreading.h" 11 | 12 | @implementation MagicalRecord (Actions) 13 | 14 | #pragma mark - Asynchronous saving 15 | 16 | + (void) saveWithBlock:(void(^)(NSManagedObjectContext *localContext))block; 17 | { 18 | [self saveWithBlock:block completion:nil]; 19 | } 20 | 21 | + (void) saveWithBlock:(void(^)(NSManagedObjectContext *localContext))block completion:(MRSaveCompletionHandler)completion; 22 | { 23 | NSManagedObjectContext *savingContext = [NSManagedObjectContext MR_rootSavingContext]; 24 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:savingContext]; 25 | 26 | [localContext performBlock:^{ 27 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 28 | 29 | if (block) { 30 | block(localContext); 31 | } 32 | 33 | [localContext MR_saveWithOptions:MRSaveParentContexts completion:completion]; 34 | }]; 35 | } 36 | 37 | #pragma mark - Synchronous saving 38 | 39 | + (void) saveWithBlockAndWait:(void(^)(NSManagedObjectContext *localContext))block; 40 | { 41 | NSManagedObjectContext *savingContext = [NSManagedObjectContext MR_rootSavingContext]; 42 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:savingContext]; 43 | 44 | [localContext performBlockAndWait:^{ 45 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 46 | 47 | if (block) { 48 | block(localContext); 49 | } 50 | 51 | [localContext MR_saveWithOptions:MRSaveParentContexts|MRSaveSynchronously completion:nil]; 52 | }]; 53 | } 54 | 55 | @end 56 | 57 | #pragma mark - Deprecated Methods — DO NOT USE 58 | @implementation MagicalRecord (ActionsDeprecated) 59 | 60 | + (void) saveUsingCurrentThreadContextWithBlock:(void (^)(NSManagedObjectContext *localContext))block completion:(MRSaveCompletionHandler)completion; 61 | { 62 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread]; 63 | 64 | [localContext performBlock:^{ 65 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 66 | 67 | if (block) { 68 | block(localContext); 69 | } 70 | 71 | [localContext MR_saveWithOptions:MRSaveParentContexts completion:completion]; 72 | }]; 73 | } 74 | 75 | + (void) saveUsingCurrentThreadContextWithBlockAndWait:(void (^)(NSManagedObjectContext *localContext))block; 76 | { 77 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread]; 78 | 79 | [localContext performBlockAndWait:^{ 80 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 81 | 82 | if (block) { 83 | block(localContext); 84 | } 85 | 86 | [localContext MR_saveWithOptions:MRSaveParentContexts|MRSaveSynchronously completion:nil]; 87 | }]; 88 | } 89 | 90 | + (void) saveInBackgroundWithBlock:(void(^)(NSManagedObjectContext *localContext))block 91 | { 92 | [[self class] saveWithBlock:block completion:nil]; 93 | } 94 | 95 | + (void) saveInBackgroundWithBlock:(void(^)(NSManagedObjectContext *localContext))block completion:(void(^)(void))completion 96 | { 97 | NSManagedObjectContext *savingContext = [NSManagedObjectContext MR_rootSavingContext]; 98 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:savingContext]; 99 | 100 | [localContext performBlock:^{ 101 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 102 | 103 | if (block) 104 | { 105 | block(localContext); 106 | } 107 | 108 | [localContext MR_saveToPersistentStoreAndWait]; 109 | 110 | if (completion) 111 | { 112 | completion(); 113 | } 114 | }]; 115 | } 116 | 117 | + (void) saveInBackgroundUsingCurrentContextWithBlock:(void (^)(NSManagedObjectContext *localContext))block completion:(void (^)(void))completion errorHandler:(void (^)(NSError *error))errorHandler; 118 | { 119 | NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread]; 120 | 121 | [localContext performBlock:^{ 122 | [localContext MR_setWorkingName:NSStringFromSelector(_cmd)]; 123 | 124 | if (block) { 125 | block(localContext); 126 | } 127 | 128 | [localContext MR_saveToPersistentStoreWithCompletion:^(BOOL contextDidSave, NSError *error) { 129 | if (contextDidSave) { 130 | if (completion) { 131 | completion(); 132 | } 133 | } 134 | else { 135 | if (errorHandler) { 136 | errorHandler(error); 137 | } 138 | } 139 | }]; 140 | }]; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+ErrorHandling.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+ErrorHandling.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/6/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MagicalRecord (ErrorHandling) 13 | 14 | + (void) handleErrors:(MR_nonnull NSError *)error; 15 | - (void) handleErrors:(MR_nonnull NSError *)error; 16 | 17 | + (void) setErrorHandlerTarget:(MR_nullable id)target action:(MR_nonnull SEL)action; 18 | + (MR_nonnull SEL) errorHandlerAction; 19 | + (MR_nullable id) errorHandlerTarget; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+ErrorHandling.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+ErrorHandling.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/6/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "MagicalRecord+ErrorHandling.h" 10 | #import "MagicalRecordLogging.h" 11 | 12 | 13 | __weak static id errorHandlerTarget = nil; 14 | static SEL errorHandlerAction = nil; 15 | 16 | 17 | @implementation MagicalRecord (ErrorHandling) 18 | 19 | + (void) cleanUpErrorHanding; 20 | { 21 | errorHandlerTarget = nil; 22 | errorHandlerAction = nil; 23 | } 24 | 25 | + (void) defaultErrorHandler:(NSError *)error 26 | { 27 | NSDictionary *userInfo = [error userInfo]; 28 | for (NSArray *detailedError in [userInfo allValues]) 29 | { 30 | if ([detailedError isKindOfClass:[NSArray class]]) 31 | { 32 | for (NSError *e in detailedError) 33 | { 34 | if ([e respondsToSelector:@selector(userInfo)]) 35 | { 36 | MRLogError(@"Error Details: %@", [e userInfo]); 37 | } 38 | else 39 | { 40 | MRLogError(@"Error Details: %@", e); 41 | } 42 | } 43 | } 44 | else 45 | { 46 | MRLogError(@"Error: %@", detailedError); 47 | } 48 | } 49 | MRLogError(@"Error Message: %@", [error localizedDescription]); 50 | MRLogError(@"Error Domain: %@", [error domain]); 51 | MRLogError(@"Recovery Suggestion: %@", [error localizedRecoverySuggestion]); 52 | } 53 | 54 | + (void) handleErrors:(NSError *)error 55 | { 56 | if (error) 57 | { 58 | // If a custom error handler is set, call that 59 | if (errorHandlerTarget != nil && errorHandlerAction != nil) 60 | { 61 | #pragma clang diagnostic push 62 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 63 | [errorHandlerTarget performSelector:errorHandlerAction withObject:error]; 64 | #pragma clang diagnostic pop 65 | } 66 | else 67 | { 68 | // Otherwise, fall back to the default error handling 69 | [self defaultErrorHandler:error]; 70 | } 71 | } 72 | } 73 | 74 | + (id) errorHandlerTarget 75 | { 76 | return errorHandlerTarget; 77 | } 78 | 79 | + (SEL) errorHandlerAction 80 | { 81 | return errorHandlerAction; 82 | } 83 | 84 | + (void) setErrorHandlerTarget:(id)target action:(SEL)action 85 | { 86 | errorHandlerTarget = target; /* Deliberately don't retain to avoid potential retain cycles */ 87 | errorHandlerAction = action; 88 | } 89 | 90 | - (void) handleErrors:(NSError *)error 91 | { 92 | [[self class] handleErrors:error]; 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+Options.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+Options.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/6/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "MagicalRecord+Options.h" 10 | 11 | #ifdef DEBUG 12 | static MagicalRecordLoggingLevel kMagicalRecordLoggingLevel = MagicalRecordLoggingLevelDebug; 13 | #else 14 | static MagicalRecordLoggingLevel kMagicalRecordLoggingLevel = MagicalRecordLoggingLevelError; 15 | #endif 16 | static BOOL kMagicalRecordShouldAutoCreateManagedObjectModel = NO; 17 | static BOOL kMagicalRecordShouldAutoCreateDefaultPersistentStoreCoordinator = NO; 18 | static BOOL kMagicalRecordShouldDeleteStoreOnModelMismatch = NO; 19 | 20 | @implementation MagicalRecord (Options) 21 | 22 | #pragma mark - Configuration Options 23 | 24 | + (BOOL) shouldAutoCreateManagedObjectModel; 25 | { 26 | return kMagicalRecordShouldAutoCreateManagedObjectModel; 27 | } 28 | 29 | + (void) setShouldAutoCreateManagedObjectModel:(BOOL)autoCreate; 30 | { 31 | kMagicalRecordShouldAutoCreateManagedObjectModel = autoCreate; 32 | } 33 | 34 | + (BOOL) shouldAutoCreateDefaultPersistentStoreCoordinator; 35 | { 36 | return kMagicalRecordShouldAutoCreateDefaultPersistentStoreCoordinator; 37 | } 38 | 39 | + (void) setShouldAutoCreateDefaultPersistentStoreCoordinator:(BOOL)autoCreate; 40 | { 41 | kMagicalRecordShouldAutoCreateDefaultPersistentStoreCoordinator = autoCreate; 42 | } 43 | 44 | + (BOOL) shouldDeleteStoreOnModelMismatch; 45 | { 46 | return kMagicalRecordShouldDeleteStoreOnModelMismatch; 47 | } 48 | 49 | + (void) setShouldDeleteStoreOnModelMismatch:(BOOL)shouldDelete; 50 | { 51 | kMagicalRecordShouldDeleteStoreOnModelMismatch = shouldDelete; 52 | } 53 | 54 | + (MagicalRecordLoggingLevel) loggingLevel; 55 | { 56 | return kMagicalRecordLoggingLevel; 57 | } 58 | 59 | + (void) setLoggingLevel:(MagicalRecordLoggingLevel)level; 60 | { 61 | kMagicalRecordLoggingLevel = level; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+Setup.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+Setup.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MagicalRecord (Setup) 13 | 14 | + (void) setupCoreDataStack; 15 | + (void) setupCoreDataStackWithInMemoryStore; 16 | + (void) setupAutoMigratingCoreDataStack; 17 | 18 | + (void) setupCoreDataStackWithStoreNamed:(MR_nonnull NSString *)storeName; 19 | + (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(MR_nonnull NSString *)storeName; 20 | 21 | + (void) setupCoreDataStackWithStoreAtURL:(MR_nonnull NSURL *)storeURL; 22 | + (void) setupCoreDataStackWithAutoMigratingSqliteStoreAtURL:(MR_nonnull NSURL *)storeURL; 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+Setup.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+Setup.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "MagicalRecord+Setup.h" 10 | #import "NSManagedObject+MagicalRecord.h" 11 | #import "NSPersistentStoreCoordinator+MagicalRecord.h" 12 | #import "NSManagedObjectContext+MagicalRecord.h" 13 | 14 | @implementation MagicalRecord (Setup) 15 | 16 | + (void) setupCoreDataStack 17 | { 18 | [self setupCoreDataStackWithStoreNamed:[self defaultStoreName]]; 19 | } 20 | 21 | + (void) setupAutoMigratingCoreDataStack 22 | { 23 | [self setupCoreDataStackWithAutoMigratingSqliteStoreNamed:[self defaultStoreName]]; 24 | } 25 | 26 | + (void) setupCoreDataStackWithStoreNamed:(NSString *)storeName 27 | { 28 | if ([NSPersistentStoreCoordinator MR_defaultStoreCoordinator] != nil) return; 29 | 30 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithSqliteStoreNamed:storeName]; 31 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 32 | 33 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 34 | } 35 | 36 | + (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName 37 | { 38 | if ([NSPersistentStoreCoordinator MR_defaultStoreCoordinator] != nil) return; 39 | 40 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithAutoMigratingSqliteStoreNamed:storeName]; 41 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 42 | 43 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 44 | } 45 | 46 | + (void) setupCoreDataStackWithStoreAtURL:(NSURL *)storeURL 47 | { 48 | if ([NSPersistentStoreCoordinator MR_defaultStoreCoordinator] != nil) return; 49 | 50 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithSqliteStoreAtURL:storeURL]; 51 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 52 | 53 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 54 | } 55 | 56 | + (void) setupCoreDataStackWithAutoMigratingSqliteStoreAtURL:(NSURL *)storeURL 57 | { 58 | if ([NSPersistentStoreCoordinator MR_defaultStoreCoordinator] != nil) return; 59 | 60 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithAutoMigratingSqliteStoreAtURL:storeURL]; 61 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 62 | 63 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 64 | } 65 | 66 | + (void) setupCoreDataStackWithInMemoryStore; 67 | { 68 | if ([NSPersistentStoreCoordinator MR_defaultStoreCoordinator] != nil) return; 69 | 70 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithInMemoryStore]; 71 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 72 | 73 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+ShorthandMethods.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 Magical Panda Software LLC. All rights reserved. 3 | 4 | #import 5 | 6 | @interface MagicalRecord (ShorthandMethods) 7 | 8 | + (void)enableShorthandMethods; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+iCloud.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+iCloud.h 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MagicalRecord (iCloud) 13 | 14 | + (BOOL)isICloudEnabled; 15 | 16 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 17 | localStoreNamed:(MR_nonnull NSString *)localStore; 18 | 19 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 20 | contentNameKey:(MR_nullable NSString *)contentNameKey 21 | localStoreNamed:(MR_nonnull NSString *)localStoreName 22 | cloudStorePathComponent:(MR_nullable NSString *)pathSubcomponent; 23 | 24 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 25 | contentNameKey:(MR_nullable NSString *)contentNameKey 26 | localStoreNamed:(MR_nonnull NSString *)localStoreName 27 | cloudStorePathComponent:(MR_nullable NSString *)pathSubcomponent 28 | completion:(void (^ __MR_nullable)(void))completion; 29 | 30 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 31 | localStoreAtURL:(MR_nonnull NSURL *)storeURL; 32 | 33 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 34 | contentNameKey:(MR_nullable NSString *)contentNameKey 35 | localStoreAtURL:(MR_nonnull NSURL *)storeURL 36 | cloudStorePathComponent:(MR_nullable NSString *)pathSubcomponent; 37 | 38 | + (void)setupCoreDataStackWithiCloudContainer:(MR_nonnull NSString *)containerID 39 | contentNameKey:(MR_nullable NSString *)contentNameKey 40 | localStoreAtURL:(MR_nonnull NSURL *)storeURL 41 | cloudStorePathComponent:(MR_nullable NSString *)pathSubcomponent 42 | completion:(void (^ __MR_nullable)(void))completion; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecord+iCloud.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord+iCloud.m 3 | // Magical Record 4 | // 5 | // Created by Saul Mora on 3/7/12. 6 | // Copyright (c) 2012 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import "MagicalRecord+iCloud.h" 10 | #import "NSPersistentStoreCoordinator+MagicalRecord.h" 11 | #import "NSManagedObjectContext+MagicalRecord.h" 12 | 13 | static BOOL _iCloudEnabled = NO; 14 | 15 | @implementation MagicalRecord (iCloud) 16 | 17 | #pragma mark - iCloud Methods 18 | 19 | + (BOOL) isICloudEnabled; 20 | { 21 | return _iCloudEnabled; 22 | } 23 | 24 | + (void) setICloudEnabled:(BOOL)enabled; 25 | { 26 | @synchronized(self) 27 | { 28 | _iCloudEnabled = enabled; 29 | } 30 | } 31 | 32 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID localStoreNamed:(NSString *)localStore; 33 | { 34 | [self setupCoreDataStackWithiCloudContainer:containerID 35 | contentNameKey:nil 36 | localStoreNamed:localStore 37 | cloudStorePathComponent:nil]; 38 | } 39 | 40 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID contentNameKey:(NSString *)contentNameKey localStoreNamed:(NSString *)localStoreName cloudStorePathComponent:(NSString *)pathSubcomponent; 41 | { 42 | [self setupCoreDataStackWithiCloudContainer:containerID 43 | contentNameKey:contentNameKey 44 | localStoreNamed:localStoreName 45 | cloudStorePathComponent:pathSubcomponent 46 | completion:nil]; 47 | } 48 | 49 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID contentNameKey:(NSString *)contentNameKey localStoreNamed:(NSString *)localStoreName cloudStorePathComponent:(NSString *)pathSubcomponent completion:(void(^)(void))completion; 50 | { 51 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithiCloudContainerID:containerID 52 | contentNameKey:contentNameKey 53 | localStoreNamed:localStoreName 54 | cloudStorePathComponent:pathSubcomponent 55 | completion:completion]; 56 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 57 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 58 | } 59 | 60 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID localStoreAtURL:(NSURL *)storeURL 61 | { 62 | NSString *contentNameKey = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleIdentifierKey]; 63 | [self setupCoreDataStackWithiCloudContainer:containerID 64 | contentNameKey:contentNameKey 65 | localStoreAtURL:storeURL 66 | cloudStorePathComponent:nil]; 67 | } 68 | 69 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID contentNameKey:(NSString *)contentNameKey localStoreAtURL:(NSURL *)storeURL cloudStorePathComponent:(NSString *)pathSubcomponent 70 | { 71 | [self setupCoreDataStackWithiCloudContainer:containerID 72 | contentNameKey:contentNameKey 73 | localStoreAtURL:storeURL 74 | cloudStorePathComponent:pathSubcomponent 75 | completion:nil]; 76 | } 77 | 78 | + (void) setupCoreDataStackWithiCloudContainer:(NSString *)containerID contentNameKey:(NSString *)contentNameKey localStoreAtURL:(NSURL *)storeURL cloudStorePathComponent:(NSString *)pathSubcomponent completion:(void (^)(void))completion 79 | { 80 | NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_coordinatorWithiCloudContainerID:containerID contentNameKey:contentNameKey localStoreAtURL:storeURL cloudStorePathComponent:pathSubcomponent completion:completion]; 81 | 82 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; 83 | [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecordDeprecationMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Tony Arnold on 10/04/2014. 3 | // Copyright (c) 2014 Magical Panda Software LLC. All rights reserved. 4 | // 5 | 6 | #define MR_DEPRECATED_WILL_BE_REMOVED_IN(VERSION) __attribute__((deprecated("This method has been deprecated and will be removed in MagicalRecord " VERSION "."))) 7 | #define MR_DEPRECATED_WILL_BE_REMOVED_IN_PLEASE_USE(VERSION, METHOD) __attribute__((deprecated("This method has been deprecated and will be removed in MagicalRecord " VERSION ". Please use `" METHOD "` instead."))) 8 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecordInternal.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord.h 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | /** 12 | Defines current and historical version numbers for MagicalRecord. 13 | 14 | @since Available in v2.3 and later. 15 | */ 16 | typedef NS_ENUM(NSUInteger, MagicalRecordVersionTag) 17 | { 18 | /** Version 2.2.0 */ 19 | MagicalRecordVersionTag2_2 = 220, 20 | 21 | /** Version 2.3.0 */ 22 | MagicalRecordVersionTag2_3 = 230, 23 | 24 | /** Version 3.0.0 */ 25 | MagicalRecordVersionTag3_0 = 300 26 | }; 27 | 28 | // enable to use caches for the fetchedResultsControllers (iOS only) 29 | // #define STORE_USE_CACHE 30 | 31 | #ifdef NS_BLOCKS_AVAILABLE 32 | 33 | OBJC_EXPORT NSString * __MR_nonnull const kMagicalRecordCleanedUpNotification; 34 | 35 | @class NSManagedObjectContext; 36 | typedef void (^CoreDataBlock)(NSManagedObjectContext * __MR_nonnull context); 37 | 38 | #endif 39 | 40 | /** 41 | Provides class methods to help setup, save, handle errors and provide information about the currently loaded version of MagicalRecord. 42 | 43 | @since Available in v1.0 and later. 44 | */ 45 | @interface MagicalRecord : NSObject 46 | 47 | /** 48 | Returns the current version of MagicalRecord. See the MagicalRecordVersionTag enumeration for valid current and historical values. 49 | 50 | @return The current version as a double. 51 | 52 | @since Available in v2.3 and later. 53 | */ 54 | + (MagicalRecordVersionTag) version; 55 | 56 | /** 57 | Provides information about the current stack, including the model, coordinator, persistent store, the default context and any parent contexts of the default context. 58 | 59 | @return Description of the current state of the stack. 60 | 61 | @since Available in v2.3 and later. 62 | */ 63 | + (MR_nonnull NSString *) currentStack; 64 | 65 | /** 66 | Cleans up the entire MagicalRecord stack. Sets the default model, store and context to nil before posting a kMagicalRecordCleanedUpNotification notification. 67 | 68 | @since Available in v1.0 and later. 69 | */ 70 | + (void) cleanUp; 71 | 72 | /** 73 | Calls NSBundle's -bundleForClass: to determine the bundle to search for the default model within. 74 | 75 | @param modelClass Class to set the model from 76 | 77 | @since Available in v2.0 and later. 78 | */ 79 | + (void) setDefaultModelFromClass:(MR_nonnull Class)modelClass; 80 | 81 | /** 82 | Looks for a momd file with the specified name, and if found sets it as the default model. 83 | 84 | @param modelName Model name as a string, including file extension 85 | 86 | @since Available in v1.0 and later. 87 | */ 88 | + (void) setDefaultModelNamed:(MR_nonnull NSString *)modelName; 89 | 90 | /** 91 | Determines the store file name your app should use. This method is used by the MagicalRecord SQLite stacks when a store file is not specified. The file name returned is in the form ".sqlite". `` is taken from the application's info dictionary, which is retrieved from the method [[NSBundle mainBundle] infoDictionary]. If no bundle name is available, "CoreDataStore.sqlite" will be used. 92 | 93 | @return String of the form .sqlite 94 | 95 | @since Available in v2.0 and later. 96 | */ 97 | + (MR_nonnull NSString *) defaultStoreName; 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecordInternal.m: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord.m 3 | // 4 | // Created by Saul Mora on 3/11/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import "MagicalRecord.h" 9 | 10 | NSString * const kMagicalRecordCleanedUpNotification = @"kMagicalRecordCleanedUpNotification"; 11 | 12 | @interface MagicalRecord (Internal) 13 | 14 | + (void) cleanUpStack; 15 | + (void) cleanUpErrorHanding; 16 | 17 | @end 18 | 19 | @interface NSManagedObjectContext (MagicalRecordInternal) 20 | 21 | + (void) MR_cleanUp; 22 | 23 | @end 24 | 25 | 26 | @implementation MagicalRecord 27 | 28 | + (MagicalRecordVersionTag) version 29 | { 30 | return MagicalRecordVersionTag2_3; 31 | } 32 | 33 | + (void) cleanUp 34 | { 35 | [self cleanUpErrorHanding]; 36 | [self cleanUpStack]; 37 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 38 | [notificationCenter postNotificationName:kMagicalRecordCleanedUpNotification 39 | object:nil 40 | userInfo:nil]; 41 | } 42 | 43 | + (void) cleanUpStack; 44 | { 45 | [NSManagedObjectContext MR_cleanUp]; 46 | [NSManagedObjectModel MR_setDefaultManagedObjectModel:nil]; 47 | [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:nil]; 48 | [NSPersistentStore MR_setDefaultPersistentStore:nil]; 49 | } 50 | 51 | + (NSString *) currentStack 52 | { 53 | NSMutableString *status = [NSMutableString stringWithString:@"Current Default Core Data Stack: ---- \n"]; 54 | 55 | [status appendFormat:@"Model: %@\n", [[NSManagedObjectModel MR_defaultManagedObjectModel] entityVersionHashesByName]]; 56 | [status appendFormat:@"Coordinator: %@\n", [NSPersistentStoreCoordinator MR_defaultStoreCoordinator]]; 57 | [status appendFormat:@"Store: %@\n", [NSPersistentStore MR_defaultPersistentStore]]; 58 | [status appendFormat:@"Default Context: %@\n", [[NSManagedObjectContext MR_defaultContext] MR_description]]; 59 | [status appendFormat:@"Context Chain: \n%@\n", [[NSManagedObjectContext MR_defaultContext] MR_parentChain]]; 60 | 61 | return status; 62 | } 63 | 64 | + (void) setDefaultModelNamed:(NSString *)modelName; 65 | { 66 | NSManagedObjectModel *model = [NSManagedObjectModel MR_managedObjectModelNamed:modelName]; 67 | [NSManagedObjectModel MR_setDefaultManagedObjectModel:model]; 68 | } 69 | 70 | + (void) setDefaultModelFromClass:(Class)modelClass; 71 | { 72 | NSBundle *bundle = [NSBundle bundleForClass:modelClass]; 73 | NSManagedObjectModel *model = [NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:bundle]]; 74 | [NSManagedObjectModel MR_setDefaultManagedObjectModel:model]; 75 | } 76 | 77 | + (NSString *) defaultStoreName; 78 | { 79 | NSString *defaultName = [[[NSBundle mainBundle] infoDictionary] valueForKey:(id)kCFBundleNameKey]; 80 | if (defaultName == nil) 81 | { 82 | defaultName = kMagicalRecordDefaultStoreFileName; 83 | } 84 | if (![defaultName hasSuffix:@"sqlite"]) 85 | { 86 | defaultName = [defaultName stringByAppendingPathExtension:@"sqlite"]; 87 | } 88 | 89 | return defaultName; 90 | } 91 | 92 | 93 | #pragma mark - initialize 94 | 95 | + (void) initialize; 96 | { 97 | if (self == [MagicalRecord class]) 98 | { 99 | [self setShouldAutoCreateManagedObjectModel:YES]; 100 | [self setShouldAutoCreateDefaultPersistentStoreCoordinator:NO]; 101 | #ifdef DEBUG 102 | [self setShouldDeleteStoreOnModelMismatch:YES]; 103 | #else 104 | [self setShouldDeleteStoreOnModelMismatch:NO]; 105 | #endif 106 | } 107 | } 108 | 109 | @end 110 | 111 | 112 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecordLogging.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecordLogging.h 3 | // MagicalRecord 4 | // 5 | // Created by Saul Mora on 10/4/13. 6 | // Copyright (c) 2013 Magical Panda Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if MR_LOGGING_DISABLED 12 | 13 | #define MRLogError(frmt, ...) ((void)0) 14 | #define MRLogWarn(frmt, ...) ((void)0) 15 | #define MRLogInfo(frmt, ...) ((void)0) 16 | #define MRLogDebug(frmt, ...) ((void)0) 17 | #define MRLogVerbose(frmt, ...) ((void)0) 18 | 19 | #else 20 | 21 | #ifndef MR_LOGGING_CONTEXT 22 | #define MR_LOGGING_CONTEXT 0 23 | #endif 24 | 25 | #if __has_include("CocoaLumberjack.h") || __has_include("CocoaLumberjack/CocoaLumberjack.h") 26 | #define MR_LOG_LEVEL_DEF (DDLogLevel)[MagicalRecord loggingLevel] 27 | #define CAST (DDLogFlag) 28 | #import 29 | #else 30 | #define MR_LOG_LEVEL_DEF [MagicalRecord loggingLevel] 31 | #define LOG_ASYNC_ENABLED YES 32 | #define CAST 33 | #define LOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \ 34 | do \ 35 | { \ 36 | if ((lvl & flg) == flg) \ 37 | { \ 38 | NSLog(frmt, ##__VA_ARGS__); \ 39 | } \ 40 | } while (0) 41 | #endif 42 | 43 | #define MRLogError(frmt, ...) LOG_MAYBE(NO, MR_LOG_LEVEL_DEF, CAST MagicalRecordLoggingMaskError, MR_LOGGING_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 44 | #define MRLogWarn(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, MR_LOG_LEVEL_DEF, CAST MagicalRecordLoggingMaskWarn, MR_LOGGING_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 45 | #define MRLogInfo(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, MR_LOG_LEVEL_DEF, CAST MagicalRecordLoggingMaskInfo, MR_LOGGING_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 46 | #define MRLogDebug(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, MR_LOG_LEVEL_DEF, CAST MagicalRecordLoggingMaskDebug, MR_LOGGING_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 47 | #define MRLogVerbose(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, MR_LOG_LEVEL_DEF, CAST MagicalRecordLoggingMaskVerbose, MR_LOGGING_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/Core/MagicalRecordXcode7CompatibilityMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2015 Magical Panda Software LLC. All rights reserved. 3 | // 4 | // The following preprocessor macros can be used to adopt the new nullability annotations and generics 5 | // features available in Xcode 7, while maintaining backwards compatibility with earlier versions of 6 | // Xcode that do not support these features. 7 | // 8 | // Originally taken from https://gist.github.com/smileyborg/d513754bc1cf41678054 9 | 10 | #ifndef MagicalRecordXcode7CompatibilityMacros_h 11 | #define MagicalRecordXcode7CompatibilityMacros_h 12 | 13 | #if __has_feature(nullability) 14 | #define MR_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN 15 | #define MR_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END 16 | #define MR_nullable nullable 17 | #define MR_nonnull nonnull 18 | #define __MR_nullable __nullable 19 | #define __MR_nonnull __nonnull 20 | #else 21 | #define MR_ASSUME_NONNULL_BEGIN 22 | #define MR_ASSUME_NONNULL_END 23 | #define MR_nullable 24 | #define MR_nonnull 25 | #define __MR_nullable 26 | #define __MR_nonnull 27 | #endif 28 | 29 | #if __has_feature(objc_generics) 30 | #define MR_GENERIC(class, ...) class<__VA_ARGS__> 31 | #define MR_GENERIC_TYPE(type) type 32 | #define __MR_kindof(class) __kindof class 33 | #else 34 | #define MR_GENERIC(class, ...) class 35 | #define MR_GENERIC_TYPE(type) id 36 | #define __MR_kindof(class) id 37 | #endif 38 | 39 | #define MR_NSArrayOfNSManagedObjects MR_GENERIC(NSArray, __MR_kindof(NSManagedObject) *) * 40 | 41 | #endif /* MagicalRecordXcode7CompatibilityMacros_h */ 42 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/MagicalRecord/MagicalRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // MagicalRecord.h 3 | // 4 | // Created by Saul Mora on 28/07/10. 5 | // Copyright 2010 Magical Panda Software, LLC All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | //! Project version number for MagicalRecord. 12 | FOUNDATION_EXPORT double MagicalRecordVersionNumber; 13 | 14 | //! Project version string for MagicalRecord. 15 | FOUNDATION_EXPORT const unsigned char MagicalRecordVersionString[]; 16 | 17 | #import 18 | #import 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | -------------------------------------------------------------------------------- /Example/Pods/MagicalRecord/README.md: -------------------------------------------------------------------------------- 1 | # ![Awesome](https://github.com/magicalpanda/magicalpanda.github.com/blob/master/images/awesome_logo_small.png?raw=true) MagicalRecord 2 | 3 | [![Circle CI](https://circleci.com/gh/magicalpanda/MagicalRecord/tree/develop.svg?style=svg)](https://circleci.com/gh/magicalpanda/MagicalRecord/tree/develop) 4 | 5 | In software engineering, the active record pattern is a design pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his book Patterns of Enterprise Application Architecture. The interface to such an object would include functions such as Insert, Update, and Delete, plus properties that correspond more-or-less directly to the columns in the underlying database table. 6 | 7 | > Active record is an approach to accessing data in a database. A database table or view is wrapped into a class; thus an object instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database; when an object is updated, the corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for each column in the table or view. 8 | 9 | > *- [Wikipedia]("http://en.wikipedia.org/wiki/Active_record_pattern")* 10 | 11 | MagicalRecord was inspired by the ease of Ruby on Rails' Active Record fetching. The goals of this code are: 12 | 13 | * Clean up my Core Data related code 14 | * Allow for clear, simple, one-line fetches 15 | * Still allow the modification of the NSFetchRequest when request optimizations are needed 16 | 17 | ## Documentation 18 | 19 | - [Installation](Docs/Installing-MagicalRecord.md) 20 | - [Getting Started](Docs/Getting-Started.md) 21 | - [Working with Managed Object Contexts](Docs/Working-with-Managed-Object-Contexts.md) 22 | - [Creating Entities](Docs/Creating-Entities.md) 23 | - [Deleting Entities](Docs/Deleting-Entities.md) 24 | - [Fetching Entities](Docs/Fetching-Entities.md) 25 | - [Saving Entities](Docs/Saving-Entities.md) 26 | - [Importing Data](Docs/Importing-Data.md) 27 | - [Logging](Docs/Logging.md) 28 | * [Other Resources](Docs/Other-Resources.md) 29 | 30 | ## Support 31 | 32 | MagicalRecord is provided as-is, free of charge. For support, you have a few choices: 33 | 34 | - Ask your support question on [Stackoverflow.com](http://stackoverflow.com), and tag your question with **MagicalRecord**. The core team will be notified of your question only if you mark your question with this tag. The general Stack Overflow community is provided the opportunity to answer the question to help you faster, and to reap the reputation points. If the community is unable to answer, we'll try to step in and answer your question. 35 | - If you believe you have found a bug in MagicalRecord, please submit a support ticket on the [Github Issues page for MagicalRecord](http://github.com/magicalpanda/magicalrecord/issues). We'll get to them as soon as we can. Please do **NOT** ask general questions on the issue tracker. Support questions will be closed unanswered. 36 | - For more personal or immediate support, [MagicalPanda](http://magicalpanda.com/) is available for hire to consult on your project. 37 | 38 | 39 | ## Twitter 40 | 41 | Follow [@MagicalRecord](http://twitter.com/magicalrecord) on twitter to stay up to date with the latest updates relating to MagicalRecord. 42 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LoremIpsum (1.0.0) 3 | - MagicalRecord (2.3.2): 4 | - MagicalRecord/Core (= 2.3.2) 5 | - MagicalRecord/Core (2.3.2) 6 | - UIColor+MLPFlatColors (1.0) 7 | 8 | DEPENDENCIES: 9 | - LoremIpsum 10 | - MagicalRecord 11 | - UIColor+MLPFlatColors 12 | 13 | SPEC CHECKSUMS: 14 | LoremIpsum: 9029c55d36501b2ee0b05cc9ecda11d3a0479160 15 | MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755 16 | UIColor+MLPFlatColors: 14deb8f28da06ab8918c14231d4ff49ca7cd384a 17 | 18 | PODFILE CHECKSUM: 080e8ffa521c075b8b27ccb3c6428ecd77c84448 19 | 20 | COCOAPODS: 1.0.1 21 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/LoremIpsum/LoremIpsum-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_LoremIpsum : NSObject 3 | @end 4 | @implementation PodsDummy_LoremIpsum 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/LoremIpsum/LoremIpsum-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/LoremIpsum/LoremIpsum.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/LoremIpsum 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/LoremIpsum" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LoremIpsum" "${PODS_ROOT}/Headers/Public/MagicalRecord" "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MagicalRecord/MagicalRecord-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MagicalRecord : NSObject 3 | @end 4 | @implementation PodsDummy_MagicalRecord 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MagicalRecord/MagicalRecord-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import 6 | #import 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/MagicalRecord/MagicalRecord.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/MagicalRecord 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MagicalRecord" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LoremIpsum" "${PODS_ROOT}/Headers/Public/MagicalRecord" "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 4 | OTHER_LDFLAGS = -framework "CoreData" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-INSElectronicProgramGuideLayout/Pods-INSElectronicProgramGuideLayout-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## LoremIpsum 5 | 6 | Copyright (c) 2013 Lukas Kubanek. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | 14 | ## MagicalRecord 15 | 16 | Copyright (c) 2010-2015, Magical Panda Software, LLC 17 | 18 | Permission is hereby granted, free of charge, to any person 19 | obtaining a copy of this software and associated documentation 20 | files (the "Software"), to deal in the Software without 21 | restriction, including without limitation the rights to use, 22 | copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the 24 | Software is furnished to do so, subject to the following 25 | conditions: 26 | 27 | * Link to the MagicalRecord Repository at https://github.com/magicalpanda/MagicalRecord in the credits section of your application 28 | 29 | The above copyright notice and this permission notice shall be 30 | included in all copies or substantial portions of the Software. 31 | 32 | This software license is in accordance with the standard MIT License. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 35 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 36 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 37 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 38 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 39 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 40 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 41 | OTHER DEALINGS IN THE SOFTWARE. 42 | 43 | 44 | ## UIColor+MLPFlatColors 45 | 46 | MIT License 47 | ---------- 48 | >Copyright (c) 2013, Mainloop LLC 49 | 50 | >Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 51 | 52 | >The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 53 | 54 | >THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 55 | Generated by CocoaPods - https://cocoapods.org 56 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-INSElectronicProgramGuideLayout/Pods-INSElectronicProgramGuideLayout-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_INSElectronicProgramGuideLayout : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_INSElectronicProgramGuideLayout 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-INSElectronicProgramGuideLayout/Pods-INSElectronicProgramGuideLayout-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-INSElectronicProgramGuideLayout/Pods-INSElectronicProgramGuideLayout.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LoremIpsum" "${PODS_ROOT}/Headers/Public/MagicalRecord" "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/LoremIpsum" "$PODS_CONFIGURATION_BUILD_DIR/MagicalRecord" "$PODS_CONFIGURATION_BUILD_DIR/UIColor+MLPFlatColors" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LoremIpsum" -isystem "${PODS_ROOT}/Headers/Public/MagicalRecord" -isystem "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"LoremIpsum" -l"MagicalRecord" -l"UIColor+MLPFlatColors" -framework "CoreData" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-INSElectronicProgramGuideLayout/Pods-INSElectronicProgramGuideLayout.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LoremIpsum" "${PODS_ROOT}/Headers/Public/MagicalRecord" "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/LoremIpsum" "$PODS_CONFIGURATION_BUILD_DIR/MagicalRecord" "$PODS_CONFIGURATION_BUILD_DIR/UIColor+MLPFlatColors" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LoremIpsum" -isystem "${PODS_ROOT}/Headers/Public/MagicalRecord" -isystem "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"LoremIpsum" -l"MagicalRecord" -l"UIColor+MLPFlatColors" -framework "CoreData" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIColor+MLPFlatColors/UIColor+MLPFlatColors-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_UIColor_MLPFlatColors : NSObject 3 | @end 4 | @implementation PodsDummy_UIColor_MLPFlatColors 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIColor+MLPFlatColors/UIColor+MLPFlatColors-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIColor+MLPFlatColors/UIColor+MLPFlatColors.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/UIColor+MLPFlatColors 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIColor+MLPFlatColors" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LoremIpsum" "${PODS_ROOT}/Headers/Public/MagicalRecord" "${PODS_ROOT}/Headers/Public/UIColor+MLPFlatColors" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Example/Pods/UIColor+MLPFlatColors/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | ---------- 3 | >Copyright (c) 2013, Mainloop LLC 4 | 5 | >Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | >The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | >THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Example/Pods/UIColor+MLPFlatColors/README.md: -------------------------------------------------------------------------------- 1 | UIColor+MLPFlatColors 2 | ================ 3 | 4 | > Although the _UIColor_ class comes with built in convenience methods for producing standard colors, most of these colors are too bright and gaudy for any real use other than prototyping. So, here's a category for _UIColor_ that adds 20 new colors that developers may actually want to use in a real app, based off the current trend of flat UI color schemes. It's called _UIColor+MLPFlatColors_. 5 | 6 | ![Screenshot](/colorsDemo.png "Screenshot") 7 | 8 | 9 | About 10 | --------- 11 | _UIColor+MLPFlatColors_ is a category for _UIColor_ that adds 20 new class methods that produce colors designed for flat interface designs. It also adds some methods for choosing a random color out of these 20 new colors, and a macro for converting hex values to an RGB color. 12 | 13 | Usage 14 | --------- 15 | Add the _UIColor+MLPFlatColors_ header and implementation file to your project. (.h & .m) 16 | 17 | After doing that, you'll be able to produce flat colors by calling the class methods defined in the _MLPFlatColors_ category. Each flat color method is prefixed with the word "flat" for easy recognition in Xcode's code complete. 18 | 19 | You can also produce random flat colors with these methods: 20 | 21 | `+ (UIColor *)randomFlatColor;` 22 | `+ (UIColor *)randomFlatLightColor;` 23 | `+ (UIColor *)randomFlatDarkColor;` 24 | 25 | License 26 | -------- 27 | _UIColor+MLPFlatColors_ uses the MIT License: 28 | 29 | >Copyright (c) 2013, Mainloop LLC 30 | 31 | >Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 32 | 33 | >The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 34 | 35 | >THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 36 | -------------------------------------------------------------------------------- /Example/Pods/UIColor+MLPFlatColors/UIColor+MLPFlatColors/UIColor+MLPFlatColors.h: -------------------------------------------------------------------------------- 1 | /* 2 | // UIColor+MLPFlatColors.h 3 | // 4 | // 5 | // Created by Eddy Borja on 4/10/13. 6 | // Copyright (c) 2013 Mainloop LLC. All rights reserved. 7 | // 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | 17 | #import 18 | #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 19 | green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ 20 | blue:((float)(rgbValue & 0xFF))/255.0 \ 21 | alpha:1.0] 22 | @interface UIColor (MLPFlatColors) 23 | 24 | + (UIColor *)flatRedColor; 25 | + (UIColor *)flatDarkRedColor; 26 | 27 | + (UIColor *)flatGreenColor; 28 | + (UIColor *)flatDarkGreenColor; 29 | 30 | + (UIColor *)flatBlueColor; 31 | + (UIColor *)flatDarkBlueColor; 32 | 33 | + (UIColor *)flatTealColor; 34 | + (UIColor *)flatDarkTealColor; 35 | 36 | + (UIColor *)flatPurpleColor; 37 | + (UIColor *)flatDarkPurpleColor; 38 | 39 | + (UIColor *)flatBlackColor; 40 | + (UIColor *)flatDarkBlackColor; 41 | 42 | + (UIColor *)flatYellowColor; 43 | + (UIColor *)flatDarkYellowColor; 44 | 45 | + (UIColor *)flatOrangeColor; 46 | + (UIColor *)flatDarkOrangeColor; 47 | 48 | + (UIColor *)flatWhiteColor; 49 | + (UIColor *)flatDarkWhiteColor; 50 | 51 | + (UIColor *)flatGrayColor; 52 | + (UIColor *)flatDarkGrayColor; 53 | 54 | + (UIColor *)randomFlatColor; 55 | + (UIColor *)randomFlatLightColor; 56 | + (UIColor *)randomFlatDarkColor; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /INSElectronicProgramGuideLayout.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'INSElectronicProgramGuideLayout' 3 | s.version = '1.1.1' 4 | s.license = 'BSD' 5 | s.summary = 'UICollectionViewLayout for displaying electronic program guide.' 6 | s.homepage = 'http://inspace.io' 7 | s.authors = 'inspace.io' 8 | s.source = { :git => 'https://github.com/inspace-io/INSElectronicProgramGuideLayout.git', :tag => '1.1.1' } 9 | s.source_files = 'INSElectronicProgramGuideLayout/*.{h,m}' 10 | s.requires_arc = true 11 | 12 | s.platform = :ios, '7.0' 13 | s.frameworks = 'UIKit' 14 | end -------------------------------------------------------------------------------- /INSElectronicProgramGuideLayout/INSTimerWeakTarget.h: -------------------------------------------------------------------------------- 1 | // 2 | // INSElectronicProgramGuideLayout.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface INSTimerWeakTarget : NSObject 29 | @property (nonatomic, weak) id target; 30 | @property (nonatomic, assign) SEL selector; 31 | 32 | @property (nonatomic, readonly) SEL fireSelector; 33 | 34 | - (id)initWithTarget:(id)target selector:(SEL)selector; 35 | @end 36 | -------------------------------------------------------------------------------- /INSElectronicProgramGuideLayout/INSTimerWeakTarget.m: -------------------------------------------------------------------------------- 1 | // 2 | // INSElectronicProgramGuideLayout.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "INSTimerWeakTarget.h" 27 | 28 | @implementation INSTimerWeakTarget 29 | 30 | - (id)initWithTarget:(id)target selector:(SEL)selector 31 | { 32 | self = [super init]; 33 | if (self) { 34 | self.target = target; 35 | self.selector = selector; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)fire:(NSTimer *)timer 41 | { 42 | #pragma clang diagnostic push 43 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 44 | [self.target performSelector:self.selector withObject:timer]; 45 | #pragma clang diagnostic pop 46 | } 47 | 48 | - (SEL)fireSelector 49 | { 50 | return @selector(fire:); 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /INSElectronicProgramGuideLayout/NSDate+INSUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // INSElectronicProgramGuideLayout.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface NSDate (INSUtils) 29 | 30 | - (BOOL)ins_isLaterThan:(NSDate *)date; 31 | - (BOOL)ins_isEarlierThan:(NSDate *)date; 32 | - (BOOL)ins_isLaterThanOrEqualTo:(NSDate *)date; 33 | - (BOOL)ins_isEarlierThanOrEqualTo:(NSDate *)date; 34 | 35 | - (NSDate *)ins_dateByAddingHours:(NSInteger)hour; 36 | - (NSDate *)ins_dateWithoutMinutesAndSeconds; 37 | @end 38 | -------------------------------------------------------------------------------- /INSElectronicProgramGuideLayout/NSDate+INSUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // INSElectronicProgramGuideLayout.h 3 | // INSElectronicProgramGuideLayout 4 | // 5 | // Created by Michał Zaborowski on 29.09.2014. 6 | // Copyright (c) 2014 inspace.io. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "NSDate+INSUtils.h" 27 | 28 | @implementation NSDate (INSUtils) 29 | 30 | - (BOOL)ins_isLaterThan:(NSDate *)date 31 | { 32 | if (self.timeIntervalSince1970 > date.timeIntervalSince1970) { 33 | return YES; 34 | } 35 | return NO; 36 | } 37 | - (BOOL)ins_isEarlierThan:(NSDate *)date 38 | { 39 | if (self.timeIntervalSince1970 < date.timeIntervalSince1970) { 40 | return YES; 41 | } 42 | return NO; 43 | } 44 | - (BOOL)ins_isLaterThanOrEqualTo:(NSDate *)date 45 | { 46 | if (self.timeIntervalSince1970 >= date.timeIntervalSince1970) { 47 | return YES; 48 | } 49 | return NO; 50 | } 51 | - (BOOL)ins_isEarlierThanOrEqualTo:(NSDate *)date 52 | { 53 | if (self.timeIntervalSince1970 <= date.timeIntervalSince1970) { 54 | return YES; 55 | } 56 | return NO; 57 | } 58 | 59 | - (NSDate *)ins_dateByAddingHours:(NSInteger)hour 60 | { 61 | return [self dateByAddingTimeInterval:(hour * 3600)]; 62 | } 63 | 64 | - (NSDate *)ins_dateWithoutMinutesAndSeconds 65 | { 66 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 67 | [calendar setTimeZone:[NSTimeZone defaultTimeZone]]; 68 | 69 | NSDateComponents *dateComponents = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour 70 | fromDate:self]; 71 | [dateComponents setMinute:0]; 72 | [dateComponents setSecond:0]; 73 | 74 | return [calendar dateFromComponents:dateComponents]; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 inspace.io All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | -------------------------------------------------------------------------------- /Screens/animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Screens/animation.gif -------------------------------------------------------------------------------- /Screens/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m1entus/INSElectronicProgramGuideLayout/87ef920b9b6e01e27300c1979f7a6ddbc91f4e32/Screens/screen.png --------------------------------------------------------------------------------