Skip to content

Commit e350de2

Browse files
committed
Use type-safe keypath constructor in PFRelationState.
1 parent a148058 commit e350de2

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

Parse/Internal/Relation/State/PFMutableRelationState.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ @implementation PFMutableRelationState
2828
+ (NSDictionary *)propertyAttributes {
2929
NSMutableDictionary *parentAttributes = [[super propertyAttributes] mutableCopy];
3030

31-
parentAttributes[@"knownObjects"] = [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeMutableCopy];
31+
parentAttributes[PFRelationStatePropertyName(knownObjects)] = [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeMutableCopy];
3232

3333
return parentAttributes;
3434
}

Parse/Internal/Relation/State/PFRelationState.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ @implementation PFRelationState
1919
///--------------------------------------
2020

2121
+ (NSDictionary *)propertyAttributes {
22-
return @{
23-
@"parent": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeWeak],
24-
@"parentClassName": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
25-
@"parentObjectId": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
26-
@"targetClass": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
27-
@"knownObjects": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
28-
@"key": [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
29-
};
22+
return @{ PFRelationStatePropertyName(parent): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeWeak],
23+
PFRelationStatePropertyName(parentClassName): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
24+
PFRelationStatePropertyName(parentObjectId): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
25+
PFRelationStatePropertyName(targetClass): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
26+
PFRelationStatePropertyName(knownObjects): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy],
27+
PFRelationStatePropertyName(key): [PFPropertyAttributes attributesWithAssociationType:PFPropertyInfoAssociationTypeCopy] };
3028
}
3129

3230
///--------------------------------------

Parse/Internal/Relation/State/PFRelationState_Private.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010
#import "PFRelationState.h"
1111

12+
#import "PFMacros.h"
13+
14+
/**
15+
Returns NSString representation of a property.
16+
17+
@param NAME The name of the property.
18+
19+
@return NSString representation of a given property.
20+
*/
21+
#define PFRelationStatePropertyName(NAME) @keypath(PFRelationState, NAME)
22+
1223
@interface PFRelationState() {
1324
@protected
1425
__weak PFObject *_parent;

0 commit comments

Comments
 (0)