Created
December 9, 2014 16:04
-
-
Save alexruperez/1342d04badfe01c13ade to your computer and use it in GitHub Desktop.
Parse Extensions Categories Objective-C iOS SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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