Simple superclass for models persisted to Parse.com.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
OEGParseBackedModel.h
OEGParseBackedModel.m
OEGParseBackedModelTests.h
OEGParseBackedModelTests.m
README.md

README.md

OEGParseBackedModel

Simple superclass for models persisted to Parse.com.

To get a nice model class instead of dealing with generic PFObjects all the time, define your model like this:

@interface Model : OEGParseBackedModel
@property (nonatomic) NSString *name;
@end

@implementation Model
@dynamic name;

- (id)init {
  return [super initWithClassName:@"Model"];
}

@end

Then use it like this:

Model *model = [[Model alloc] init];
model.name = @"Maverick";
[model saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
  if (succeeded) {
    NSLog(@"Model saved to Parse!");
  }
}];

The code is very basic but perhaps it can serve as some kind of inspiration to someone. It should check if the property is declared as readonly and not generate a setter in that case.