Latest 0.0.1
Homepage https://github.com/hectr/MRRealmResultsController
License MIT
Platforms ios 6.0, requires ARC
Dependencies Realm
Authors

Version
License
Platform

This is untested and undocumented code not suitable for production use.

MRRealmResultsController is an alternative to NSFetchedResultsController for use with realm-cocoa.

I’ve made it because I wanted to check how well could Realm perform when used as a replacement to Core Data in an existing application with as few changes as possible made to the application code.

The MRRealmResultsControllerExample project is essentially the TableView from RealmExamples with some modifications to demonstrate the use of MRRealmResultsController.


The key differences between NSFetchedResultsController and MRRealmResultsController interfaces reside in the following methods:

// NSFetchedResultsController
- (id)initWithFetchRequest:(NSFetchRequest *)fetchRequest
      managedObjectContext: (NSManagedObjectContext *)context 
        sectionNameKeyPath:(NSString *)sectionNameKeyPath 
                 cacheName:(NSString *)name;

// MRRealmResultsController
  - (id)initWithClass:(Class)objectClass
            predicate:(NSPredicate *)predicate
                realm:(RLMRealm *)realmOrNil
       sortDescriptor:(NSSortDescriptor *)sortDescriptor
sectionSortDescriptor:(NSSortDescriptor *)sectionSortDescriptorOrNil
       andNameKeyPath:(NSString *)sectionNameKeyPath;

// NSFetchedResultsControllerDelegate
- (void)controller:(NSFetchedResultsController *)controller 
   didChangeObject:(id)anObject
       atIndexPath:(NSIndexPath *)indexPath 
     forChangeType:(NSFetchedResultsChangeType)type 
      newIndexPath:(NSIndexPath *)newIndexPath;
- (void)controller:(NSFetchedResultsController *)controller 
  didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo 
           atIndex:(NSUInteger)sectionIndex 
     forChangeType:(NSFetchedResultsChangeType)type;

// MRRealmResultsControllerDelegate
- (void)controller:(MRRealmResultsController *)controller
  didChangeSection:(id <MRRealmSectionInfo>)sectionInfo
           atIndex:(NSUInteger)sectionIndex
     forChangeType:(MRRealmResultsChangeType)type;

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CocoaPods

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

pod "MRRealmResultsController"

Manually

Perform the following steps:

License

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

Alternatives

Latest podspec

{
    "name": "MRRealmResultsController",
    "version": "0.0.1",
    "summary": "MRRealmResultsController is an alternative to NSFetchedResultsController for use with realm-cocoa.",
    "description": "                   *This is untested and undocumented code not suitable for production use.*nn                   `MRRealmResultsController` is an alternative to `NSFetchedResultsController` for use with **[realm-cocoa](https://github.com/realm/realm-cocoa/)**.nn                   I've made it because I wanted to check how well could **[Realm](http://realm.io)** perform when used as a replacement to **Core Data** in an existing application with as few changes as possible made to the application code.n",
    "homepage": "https://github.com/hectr/MRRealmResultsController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hu00e9ctor Marquu00e9s Ranea": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hectr/MRRealmResultsController.git",
        "tag": "0.0.1"
    },
    "source_files": "MRRealmResultsController",
    "dependencies": {
        "Realm": []
    },
    "requires_arc": true,
    "platforms": {
        "ios": "6.0"
    }
}

Pin It on Pinterest

Share This