Skip to content
Permalink
Browse files

stricter objective-c declarations

  • Loading branch information...
Coeur committed Jun 5, 2019
1 parent 669cdc6 commit d0b696c03329f82390457347bbba46322ef8948e
Showing with 98 additions and 98 deletions.
  1. +2 −2 MagicalRecord/Categories/DataImport/NSAttributeDescription+MagicalDataImport.m
  2. +3 −3 MagicalRecord/Categories/DataImport/NSEntityDescription+MagicalDataImport.m
  3. +1 −1 MagicalRecord/Categories/DataImport/NSObject+MagicalDataImport.m
  4. +1 −1 MagicalRecord/Categories/DataImport/NSRelationshipDescription+MagicalDataImport.m
  5. +1 −1 MagicalRecord/Categories/DataImport/NSString+MagicalDataImport.m
  6. +7 −7 MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalAggregation.m
  7. +4 −4 MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalDataImport.m
  8. +7 −7 MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalFinders.m
  9. +1 −1 MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRecord.m
  10. +5 −5 MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRequests.m
  11. +3 −3 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalChainSave.m
  12. +5 −5 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalObserving.m
  13. +2 −2 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalRecord.m
  14. +13 −13 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalSaves.m
  15. +1 −1 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalThreading.m
  16. +1 −1 MagicalRecord/Categories/NSManagedObjectModel+MagicalRecord.m
  17. +2 −2 MagicalRecord/Categories/NSPersistentStore+MagicalRecord.m
  18. +10 −10 MagicalRecord/Categories/NSPersistentStoreCoordinator+MagicalRecord.m
  19. +6 −6 MagicalRecord/Core/MagicalRecord+Actions.m
  20. +1 −1 MagicalRecord/Core/MagicalRecord+ErrorHandling.m
  21. +8 −8 MagicalRecord/Core/MagicalRecord+Options.m
  22. +1 −1 MagicalRecord/Core/MagicalRecord+Setup.m
  23. +5 −5 MagicalRecord/Core/MagicalRecord+iCloud.m
  24. +5 −5 MagicalRecord/Core/MagicalRecordInternal.m
  25. +1 −1 Tests/Core/MagicalRecord+StackTests.m
  26. +1 −1 Tests/DataImport/MagicalDataImportTestCase.m
  27. +1 −1 Tests/Fixtures/FixtureHelpers.m
@@ -12,12 +12,12 @@

@implementation NSAttributeDescription (MagicalRecord_DataImport)

- (NSString *) MR_primaryKey;
- (NSString *) MR_primaryKey
{
return nil;
}

- (id) MR_valueForKeyPath:(NSString *)keyPath fromObjectData:(id)objectData;
- (id) MR_valueForKeyPath:(NSString *)keyPath fromObjectData:(id)objectData
{
id value = [objectData valueForKeyPath:keyPath];

@@ -14,7 +14,7 @@

@implementation NSEntityDescription (MagicalRecord_DataImport)

- (NSAttributeDescription *) MR_primaryAttributeToRelateBy;
- (NSAttributeDescription *) MR_primaryAttributeToRelateBy
{
NSString *lookupKey = [[self userInfo] objectForKey:kMagicalRecordImportRelationshipLinkedByKey] ?: MR_primaryKeyNameFromString([self name]);
NSAttributeDescription *attributeDescription = [self MR_attributeDescriptionForName:lookupKey];
@@ -31,15 +31,15 @@ - (NSAttributeDescription *) MR_primaryAttributeToRelateBy;
return attributeDescription;
}

- (NSManagedObject *) MR_createInstanceInContext:(NSManagedObjectContext *)context;
- (NSManagedObject *) MR_createInstanceInContext:(NSManagedObjectContext *)context
{
Class relatedClass = NSClassFromString([self managedObjectClassName]);
NSManagedObject *newInstance = [relatedClass MR_createEntityInContext:context];

return newInstance;
}

- (NSAttributeDescription *) MR_attributeDescriptionForName:(NSString *)name;
- (NSAttributeDescription *) MR_attributeDescriptionForName:(NSString *)name
{
__block NSAttributeDescription *attributeDescription;

@@ -18,7 +18,7 @@

@implementation NSObject (MagicalRecord_DataImport)

- (NSString *) MR_lookupKeyForAttribute:(NSAttributeDescription *)attributeInfo;
- (NSString *) MR_lookupKeyForAttribute:(NSAttributeDescription *)attributeInfo
{
NSString *attributeName = [attributeInfo name];
NSString *lookupKey = [[attributeInfo userInfo] objectForKey:kMagicalRecordImportAttributeKeyMapKey] ?: attributeName;
@@ -12,7 +12,7 @@

@implementation NSRelationshipDescription (MagicalRecord_DataImport)

- (NSString *) MR_primaryKey;
- (NSString *) MR_primaryKey
{
NSString *primaryKeyName = [[self userInfo] objectForKey:kMagicalRecordImportRelationshipLinkedByKey] ?:
MR_primaryKeyNameFromString([[self destinationEntity] name]);
@@ -11,7 +11,7 @@

@implementation NSString (MagicalRecord_DataImport)

- (NSString *) MR_capitalizedFirstCharacterString;
- (NSString *) MR_capitalizedFirstCharacterString
{
if ([self length] > 0)
{
@@ -38,7 +38,7 @@ + (NSNumber *) MR_numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm inCont
return [NSNumber numberWithUnsignedInteger:[self MR_countOfEntitiesWithPredicate:searchTerm inContext:context]];
}

+ (NSNumber *) MR_numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;
+ (NSNumber *) MR_numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -47,28 +47,28 @@ + (NSNumber *) MR_numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;
#pragma clang diagnostic pop
}

+ (NSUInteger) MR_countOfEntities;
+ (NSUInteger) MR_countOfEntities
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self MR_countOfEntitiesWithContext:[NSManagedObjectContext MR_contextForCurrentThread]];
#pragma clang diagnostic pop
}

+ (NSUInteger) MR_countOfEntitiesWithContext:(NSManagedObjectContext *)context;
+ (NSUInteger) MR_countOfEntitiesWithContext:(NSManagedObjectContext *)context
{
return [self MR_countOfEntitiesWithPredicate:nil inContext:context];
}

+ (NSUInteger) MR_countOfEntitiesWithPredicate:(NSPredicate *)searchFilter;
+ (NSUInteger) MR_countOfEntitiesWithPredicate:(NSPredicate *)searchFilter
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self MR_countOfEntitiesWithPredicate:searchFilter inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
#pragma clang diagnostic pop
}

+ (NSUInteger) MR_countOfEntitiesWithPredicate:(NSPredicate *)searchFilter inContext:(NSManagedObjectContext *)context;
+ (NSUInteger) MR_countOfEntitiesWithPredicate:(NSPredicate *)searchFilter inContext:(NSManagedObjectContext *)context
{
NSError *error = nil;
NSFetchRequest *request = [self MR_createFetchRequestInContext:context];
@@ -162,7 +162,7 @@ + (id) MR_aggregateOperation:(NSString *)function onAttribute:(NSString *)attrib
#pragma clang diagnostic pop
}

+ (NSArray *) MR_aggregateOperation:(NSString *)collectionOperator onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate groupBy:(NSString *)groupingKeyPath inContext:(NSManagedObjectContext *)context;
+ (NSArray *) MR_aggregateOperation:(NSString *)collectionOperator onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate groupBy:(NSString *)groupingKeyPath inContext:(NSManagedObjectContext *)context
{
NSExpression *expression = [NSExpression expressionForFunction:collectionOperator arguments:[NSArray arrayWithObject:[NSExpression expressionForKeyPath:attributeName]]];

@@ -185,7 +185,7 @@ + (NSArray *) MR_aggregateOperation:(NSString *)collectionOperator onAttribute:(
return results;
}

+ (NSArray *) MR_aggregateOperation:(NSString *)collectionOperator onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate groupBy:(NSString *)groupingKeyPath;
+ (NSArray *) MR_aggregateOperation:(NSString *)collectionOperator onAttribute:(NSString *)attributeName withPredicate:(NSPredicate *)predicate groupBy:(NSString *)groupingKeyPath
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -224,7 +224,7 @@ - (void)MR_setRelationships:(NSDictionary *)relationships forKeysWithObject:(id)
}
}

- (BOOL) MR_preImport:(id)objectData;
- (BOOL) MR_preImport:(id)objectData
{
if ([self respondsToSelector:@selector(shouldImport:)])
{
@@ -243,7 +243,7 @@ - (BOOL) MR_preImport:(id)objectData;
return YES;
}

- (BOOL) MR_postImport:(id)objectData;
- (BOOL) MR_postImport:(id)objectData
{
if ([self respondsToSelector:@selector(didImport:)])
{
@@ -253,7 +253,7 @@ - (BOOL) MR_postImport:(id)objectData;
return YES;
}

- (BOOL) MR_performDataImportFromObject:(id)objectData relationshipBlock:(void(^)(NSRelationshipDescription*, id))relationshipBlock;
- (BOOL) MR_performDataImportFromObject:(id)objectData relationshipBlock:(void(^)(NSRelationshipDescription*, id))relationshipBlock
{
BOOL didStartImporting = [self MR_preImport:objectData];
if (!didStartImporting) return NO;
@@ -301,7 +301,7 @@ - (BOOL)MR_importValuesForKeysWithObject:(id)objectData
}];
}

+ (id) MR_importFromObject:(id)objectData inContext:(NSManagedObjectContext *)context;
+ (id) MR_importFromObject:(id)objectData inContext:(NSManagedObjectContext *)context
{
__block NSManagedObject *managedObject;

@@ -117,15 +117,15 @@ + (instancetype) MR_findFirstByAttribute:(NSString *)attribute withValue:(id)sea
#pragma clang diagnostic pop
}

+ (instancetype) MR_findFirstOrderedByAttribute:(NSString *)attribute ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context;
+ (instancetype) MR_findFirstOrderedByAttribute:(NSString *)attribute ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context
{
NSFetchRequest *request = [self MR_requestAllSortedBy:attribute ascending:ascending inContext:context];
[request setFetchLimit:1];

return [self MR_executeFetchRequestAndReturnFirstObject:request inContext:context];
}

+ (instancetype) MR_findFirstOrderedByAttribute:(NSString *)attribute ascending:(BOOL)ascending;
+ (instancetype) MR_findFirstOrderedByAttribute:(NSString *)attribute ascending:(BOOL)ascending
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -280,7 +280,7 @@ + (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue

#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR

+ (NSFetchedResultsController *) MR_fetchController:(NSFetchRequest *)request delegate:(id<NSFetchedResultsControllerDelegate>)delegate useFileCache:(BOOL)useFileCache groupedBy:(NSString *)groupKeyPath inContext:(NSManagedObjectContext *)context;
+ (NSFetchedResultsController *) MR_fetchController:(NSFetchRequest *)request delegate:(id<NSFetchedResultsControllerDelegate>)delegate useFileCache:(BOOL)useFileCache groupedBy:(NSString *)groupKeyPath inContext:(NSManagedObjectContext *)context
{
NSString *cacheName = useFileCache ? [NSString stringWithFormat:@"MagicalRecord-Cache-%@", NSStringFromClass([self class])] : nil;

@@ -294,15 +294,15 @@ + (NSFetchedResultsController *) MR_fetchController:(NSFetchRequest *)request de
return controller;
}

+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate;
+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self MR_fetchAllWithDelegate:delegate inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
#pragma clang diagnostic pop
}

+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context;
+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context
{
NSFetchRequest *request = [self MR_requestAllInContext:context];
NSFetchedResultsController *controller = [self MR_fetchController:request delegate:delegate useFileCache:NO groupedBy:nil inContext:context];
@@ -341,7 +341,7 @@ + (NSFetchedResultsController *) MR_fetchAllGroupedBy:(NSString *)group withPred
#pragma clang diagnostic pop
}

+ (NSFetchedResultsController *) MR_fetchAllGroupedBy:(NSString *)group withPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context;
+ (NSFetchedResultsController *) MR_fetchAllGroupedBy:(NSString *)group withPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context
{
return [self MR_fetchAllGroupedBy:group
withPredicate:searchTerm
@@ -380,7 +380,7 @@ + (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascend
return controller;
}

+ (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath;
+ (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -13,7 +13,7 @@

@implementation NSManagedObject (MagicalRecord)

+ (NSString *) MR_entityName;
+ (NSString *) MR_entityName
{
NSString *entityName;

@@ -43,15 +43,15 @@ + (NSFetchRequest *) MR_requestAllInContext:(NSManagedObjectContext *)context
return [self MR_createFetchRequestInContext:context];
}

+ (NSFetchRequest *) MR_requestAllWithPredicate:(NSPredicate *)searchTerm;
+ (NSFetchRequest *) MR_requestAllWithPredicate:(NSPredicate *)searchTerm
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self MR_requestAllWithPredicate:searchTerm inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
#pragma clang diagnostic pop
}

+ (NSFetchRequest *) MR_requestAllWithPredicate:(NSPredicate *)searchTerm inContext:(NSManagedObjectContext *)context;
+ (NSFetchRequest *) MR_requestAllWithPredicate:(NSPredicate *)searchTerm inContext:(NSManagedObjectContext *)context
{
NSFetchRequest *request = [self MR_createFetchRequestInContext:context];
[request setPredicate:searchTerm];
@@ -92,15 +92,15 @@ + (NSFetchRequest *) MR_requestFirstWithPredicate:(NSPredicate *)searchTerm inCo
return request;
}

+ (NSFetchRequest *) MR_requestFirstByAttribute:(NSString *)attribute withValue:(id)searchValue;
+ (NSFetchRequest *) MR_requestFirstByAttribute:(NSString *)attribute withValue:(id)searchValue
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self MR_requestFirstByAttribute:attribute withValue:searchValue inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
#pragma clang diagnostic pop
}

+ (NSFetchRequest *) MR_requestFirstByAttribute:(NSString *)attribute withValue:(id)searchValue inContext:(NSManagedObjectContext *)context;
+ (NSFetchRequest *) MR_requestFirstByAttribute:(NSString *)attribute withValue:(id)searchValue inContext:(NSManagedObjectContext *)context
{
NSFetchRequest *request = [self MR_requestAllWhere:attribute isEqualTo:searchValue inContext:context];
[request setFetchLimit:1];
@@ -156,7 +156,7 @@ + (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)
return request;
}

+ (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm;
+ (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -10,12 +10,12 @@
#import "NSManagedObjectContext+MagicalRecord.h"

@implementation NSManagedObjectContext (MagicalRecord_ChainSave)
- (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block;
- (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block
{
[self MR_saveWithBlock:block completion:nil];
}

- (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block completion:(MRSaveCompletionHandler)completion;
- (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block completion:(MRSaveCompletionHandler)completion
{
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:self];

@@ -32,7 +32,7 @@ - (void)MR_saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block c

#pragma mark - Synchronous saving

- (void)MR_saveWithBlockAndWait:(void (^)(NSManagedObjectContext *localContext))block;
- (void)MR_saveWithBlockAndWait:(void (^)(NSManagedObjectContext *localContext))block
{
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextWithParent:self];

@@ -46,7 +46,7 @@ - (void) MR_observeContextOnMainThread:(NSManagedObjectContext *)otherContext

#pragma mark - Context iCloud Merge Helpers

- (void) MR_mergeChangesFromiCloud:(NSNotification *)notification;
- (void) MR_mergeChangesFromiCloud:(NSNotification *)notification
{
[self performBlock:^{

@@ -64,7 +64,7 @@ - (void) MR_mergeChangesFromiCloud:(NSNotification *)notification;
}];
}

- (void) MR_mergeChangesFromNotification:(NSNotification *)notification;
- (void) MR_mergeChangesFromNotification:(NSNotification *)notification
{
MRLogVerbose(@"Merging changes to %@context%@",
self == [NSManagedObjectContext MR_defaultContext] ? @"*** DEFAULT *** " : @"",
@@ -73,7 +73,7 @@ - (void) MR_mergeChangesFromNotification:(NSNotification *)notification;
[self mergeChangesFromContextDidSaveNotification:notification];
}

- (void) MR_mergeChangesOnMainThread:(NSNotification *)notification;
- (void) MR_mergeChangesOnMainThread:(NSNotification *)notification
{
if ([NSThread isMainThread])
{
@@ -85,7 +85,7 @@ - (void) MR_mergeChangesOnMainThread:(NSNotification *)notification;
}
}

- (void) MR_observeiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator;
- (void) MR_observeiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator
{
if (![MagicalRecord isICloudEnabled]) return;
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
@@ -96,7 +96,7 @@ - (void) MR_observeiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)co

}

- (void) MR_stopObservingiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator;
- (void) MR_stopObservingiCloudChangesInCoordinator:(NSPersistentStoreCoordinator *)coordinator
{
if (![MagicalRecord isICloudEnabled]) return;
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
@@ -24,7 +24,7 @@ @implementation NSManagedObjectContext (MagicalRecord)

#pragma mark - Setup

+ (void) MR_initializeDefaultContextWithCoordinator:(NSPersistentStoreCoordinator *)coordinator;
+ (void) MR_initializeDefaultContextWithCoordinator:(NSPersistentStoreCoordinator *)coordinator
{
NSAssert(coordinator, @"Provided coordinator cannot be nil!");
if (MagicalRecordDefaultContext == nil)
@@ -49,7 +49,7 @@ + (NSManagedObjectContext *) MR_defaultContext
}
}

+ (NSManagedObjectContext *) MR_rootSavingContext;
+ (NSManagedObjectContext *) MR_rootSavingContext
{
NSAssert(MagicalRecordRootSavingContext != nil, @"Root saving context is nil! Did you forget to initialize the Core Data Stack?");
return MagicalRecordRootSavingContext;

0 comments on commit d0b696c

Please sign in to comment.
You can’t perform that action at this time.