Latest 0.2.1
Homepage https://github.com/hectr/MRFetchedResultsController
License MIT
Platforms ios 5.0, osx 10.7, requires ARC
Frameworks CoreData
Authors

Version
License
Platform

MRFetchedResultsController is a drop-in replacement for NSFetchedResultsController that works on Mac and iOS.

Its purpose is to provide an alternative that makes it possible to extend NSFetchedResultsController functionallity without having to deal with private APIs.

In apps ported to Mac OS X using Chameleon, MRFetchedResultsController addresses the lack of an implementation of NSFetchedResultsController for the platform by providing an alternative that can be used in both iOS and Mac versions of the apps.

Installation

CocoaPods

MRFetchedResultsController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "MRFetchedResultsController"

Manually

Copy MRFetchedResultsController directory into your project.

Usage

After adding files under the MRFetchedResultsController folder to your project, you can use it as you would do with NSFetchedResultsController.

When extending MRFetchedResultsController, you can expose its private methods to categories and/or subclasses by importing MRFetchedResultsController+Internal.h.

When using the fetched results controller with UICollectionView you can handle content changes by implementing the method - (void)controller:(MRFetchedResultsController *)controller didChangeSections:(NSArray *)sectionChanges andObjects:(NSArray *)objectChanges in the delegate:

- (void)controller:(MRFetchedResultsController *)controller didChangeSections:(NSArray *)sectionChanges andObjects:(NSArray *)objectChanges
{
    [self.collectionView performBatchUpdates:^{
        for (id<MRFetchedResultsSectionChangeInfo> change in sectionChanges) {
            [change performUpdateInCollectionView:self.collectionView];
        }
        for (id<MRFetchedResultsObjectChangeInfo> change in objectChanges) {
            [change performUpdateInCollectionView:self.collectionView];
        }
    } completion:nil];
}

Extras

Besides the new delegate method that provides support for - [UICollectionView performBatchUpdates:completion:]; MRFetchedResultsController.h contains 3 extra properties -not present in NSFetchedResultsController.h– for fine-tuning the behaviour of the fetched results controller’s change tracking:

// Changes in the context are not applied to the fetchedObjects array until applyFetchedObjectsChanges is set.
@property (nonatomic, assign) BOOL applyFetchedObjectsChanges;
// If set, changes in the context are not applied until the context is successfully saved.
@property (nonatomic, assign) BOOL changesAppliedOnSave;
// If set, it is used for notifying changes asynchronously.
@property (nonatomic, assign) dispatch_queue_t notifyChangesQueue;

License

MRFetchedResultsController is available under the MIT license. See the LICENSE file for more info.

Alternatives

Latest podspec

{
    "name": "MRFetchedResultsController",
    "version": "0.2.1",
    "summary": "Extensible drop-in replacement for NSFetchedResultsController.",
    "description": "**MRFetchedResultsController** is a drop-in replacement for `NSFetchedResultsController` that works on Mac and iOS.nnIts purpose is to provide an alternative that makes it possible to extend `NSFetchedResultsController` functionallity without having to deal with private APIs.nnIn apps ported to Mac OS X using [Chameleon](https://github.com/BigZaphod/Chameleon), **MRFetchedResultsController** addresses the lack of an implementation of `NSFetchedResultsController` for the platform by providing an alternative that can be used in both iOS and Mac versions of the apps.",
    "homepage": "https://github.com/hectr/MRFetchedResultsController",
    "license": "MIT",
    "authors": {
        "hectr": "[email protected]"
    },
    "social_media_url": "https://twitter.com/hectormarquesra",
    "platforms": {
        "ios": "5.0",
        "osx": "10.7"
    },
    "source": {
        "git": "https://github.com/hectr/MRFetchedResultsController.git",
        "tag": "0.2.1"
    },
    "source_files": "MRFetchedResultsController",
    "frameworks": "CoreData",
    "requires_arc": true
}

Pin It on Pinterest

Share This