Skip to content

Instantly share code, notes, and snippets.

@alexruperez
Created December 9, 2014 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexruperez/1342d04badfe01c13ade to your computer and use it in GitHub Desktop.
Save alexruperez/1342d04badfe01c13ade to your computer and use it in GitHub Desktop.
Parse Extensions Categories Objective-C iOS SDK
//
// ParseExtensions.h
//
// Created by Alejandro Rupérez on 9/12/14.
//
#import <Foundation/Foundation.h>
#import <Parse/Parse.h>
@interface PFGeoPoint (Extension)
@property (strong, nonatomic, readonly) CLLocation *location;
@end
@interface PFObject (Extension)
- (void)saveWithBlock:(PFBooleanResultBlock)block;
@end
//
// ParseExtensions.m
//
// Created by Alejandro Rupérez on 9/12/14.
//
#import "ParseExtensions.h"
@implementation PFGeoPoint (Extension)
- (CLLocation *)location
{
return [[CLLocation alloc] initWithLatitude:self.latitude longitude:self.longitude];
}
@end
@implementation PFObject (Extension)
- (void)saveWithBlock:(PFBooleanResultBlock)block
{
[self saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (!succeeded)
{
[self saveEventually:block];
}
else if (block)
{
block(YES, nil);
}
}];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment