forked from eladb/Parse-NSCoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPFGeoPoint+NSCoding.m
More file actions
34 lines (25 loc) · 824 Bytes
/
Copy pathPFGeoPoint+NSCoding.m
File metadata and controls
34 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// PFGeoPoint+NSCoding.m
// Created by Pedro Almeida on 5/1/14.
//
//
#import "PFGeoPoint+NSCoding.h"
#import "NSObject+Properties.h"
@implementation PFGeoPoint (NSCoding)
#define kPFGeoPointLatitude @"_latitude"
#define kPFGeoPointLongitude @"_longitude"
- (void)encodeWithCoder:(NSCoder*)encoder
{
//Serialize Parse-specific values
[encoder encodeDouble:[self latitude] forKey:kPFGeoPointLatitude];
[encoder encodeDouble:[self longitude] forKey:kPFGeoPointLongitude];
}
- (id)initWithCoder:(NSCoder*)aDecoder
{
//Deserialize Parse-specific values
double latitude = [aDecoder decodeDoubleForKey:kPFGeoPointLatitude];
double longitude = [aDecoder decodeDoubleForKey:kPFGeoPointLongitude];
self = [PFGeoPoint geoPointWithLatitude:latitude longitude:longitude];
return self;
}
@end