File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
1818 The `PFRelation` class that is used to access all of the children of a many-to-many relationship.
1919 Each instance of `PFRelation` is associated with a particular parent object and key.
2020 */
21- @interface PFRelation : NSObject
21+ @interface PFRelation <ObjectType : PFObject *> : NSObject
2222
2323/* *
2424 The name of the class of the target child objects.
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
3232/* *
3333 Returns a `PFQuery` object that can be used to get objects in this relation.
3434 */
35- - (PFQuery *)query ;
35+ - (PFQuery<ObjectType> *)query ;
3636
3737// /--------------------------------------
3838#pragma mark - Modifying Relations
@@ -43,14 +43,14 @@ NS_ASSUME_NONNULL_BEGIN
4343
4444 @param object A `PFObject` object to add relation to.
4545 */
46- - (void )addObject : (PFObject * )object ;
46+ - (void )addObject : (ObjectType )object ;
4747
4848/* *
4949 Removes a relation to the passed in object.
5050
5151 @param object A `PFObject` object to add relation to.
5252 */
53- - (void )removeObject : (PFObject * )object ;
53+ - (void )removeObject : (ObjectType )object ;
5454
5555@end
5656
Original file line number Diff line number Diff line change 1111
1212#import < Parse/PFObject.h>
1313#import < Parse/PFSubclassing.h>
14+ #import < Parse/PFUser.h>
1415
1516NS_ASSUME_NONNULL_BEGIN
1617
18+ @class PFRelation<ObjectType : PFObject *>;
19+
1720/* *
1821 The `PFRole` class represents a Role on the Parse server.
1922 `PFRoles` represent groupings of `PFUser` objects for the purposes of granting permissions
@@ -83,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
8386 (e.g. read or write access through ACLs). You can add or remove users from
8487 the role through this relation.
8588 */
86- @property (nonatomic , strong , readonly ) PFRelation *users;
89+ @property (nonatomic , strong , readonly ) PFRelation<PFUser *> *users;
8790
8891/* *
8992 Gets the `PFRelation` for the `PFRole` objects that are direct children of this role.
@@ -92,7 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
9295 (e.g. read or write access through ACLs). You can add or remove child roles
9396 from this role through this relation.
9497 */
95- @property (nonatomic , strong , readonly ) PFRelation *roles;
98+ @property (nonatomic , strong , readonly ) PFRelation<PFRole *> *roles;
9699
97100@end
98101
Original file line number Diff line number Diff line change @@ -51,11 +51,11 @@ + (instancetype)roleWithName:(NSString *)name acl:(PFACL *)acl {
5151@dynamic name;
5252
5353// Dynamic synthesizers would use objectForKey, not relationForKey
54- - (PFRelation *)roles {
54+ - (PFRelation<PFRole *> *)roles {
5555 return [self relationForKey: @keypath (PFRole, roles)];
5656}
5757
58- - (PFRelation *)users {
58+ - (PFRelation<PFUser *> *)users {
5959 return [self relationForKey: @keypath (PFRole, users)];
6060}
6161
You can’t perform that action at this time.
0 commit comments