Latest 1.1.0
Homepage https://github.com/OliverLetterer/SPLManagedObjectContextSnapshot
License MIT
Platforms ios 7.0, requires ARC
Frameworks CoreData
Authors

CI Status
Version
License
Platform

SPLManagedObjectContextSnapshot tracks changes made in a single NSManagedObjectContext in form of SPLManagedObjectChange instances:

typedef NS_ENUM(NSInteger, SPLManagedObjectChangeType) {
    SPLManagedObjectChangeTypeInsertion,
    SPLManagedObjectChangeTypeUpdate,
    SPLManagedObjectChangeTypeDeletion
};

@interface SPLManagedObjectChange : NSObject

@property (nonatomic, readonly) NSDate *timestamp;

@property (nonatomic, readonly) NSString *entityName;
@property (nonatomic, readonly) SPLManagedObjectChangeType type;

@property (nonatomic, readonly) NSDictionary *initialAttributes;
@property (nonatomic, readonly) NSDictionary *changedAttributes;

@end

Changes made on a different context and merged into the tracking context are ignored and counted against SPLManagedObjectChange.initialAttributes.

Usage

Allocate a new instance of SPLManagedObjectContextSnapshot

SPLManagedObjectContextSnapshot *snapshot = [[SPLManagedObjectContextSnapshot alloc] initWithManagedObjectContext:context];

When You are done tracking, process changes through

@interface SPLManagedObjectContextSnapshot : NSObject

@property (nonatomic, readonly) NSArray *insertions;
@property (nonatomic, readonly) NSArray *changes;
@property (nonatomic, readonly) NSArray *deletions;

@end

Installation

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

pod "SPLManagedObjectContextSnapshot"

Author

Oliver Letterer, [email protected]

License

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

Latest podspec

{
    "name": "SPLManagedObjectContextSnapshot",
    "version": "1.1.0",
    "summary": "Change tracking for a NSManagedObjectContext.",
    "homepage": "https://github.com/OliverLetterer/SPLManagedObjectContextSnapshot",
    "license": "MIT",
    "authors": {
        "Oliver Letterer": "[email protected]"
    },
    "source": {
        "git": "https://github.com/OliverLetterer/SPLManagedObjectContextSnapshot.git",
        "tag": "1.1.0"
    },
    "social_media_url": "https://twitter.com/oletterer",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "frameworks": "CoreData"
}

Pin It on Pinterest

Share This