PFRelation

@interface PFRelation <ObjectType : PFObject *> : NSObject

The PFRelation class that is used to access all of the children of a many-to-many relationship. Each instance of PFRelation is associated with a particular parent object and key.

  • The name of the class of the target child objects.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *targetClass;

    Swift

    var targetClass: String? { get set }
  • Returns a PFQuery object that can be used to get objects in this relation.

    Declaration

    Objective-C

    - (nonnull PFQuery<ObjectType> *)query;

    Swift

    func query() -> PFQuery
  • Adds a relation to the passed in object.

    Declaration

    Objective-C

    - (void)addObject:(nonnull ObjectType)object;

    Swift

    func add(_ object: ObjectType)

    Parameters

    object

    A PFObject object to add relation to.

  • Removes a relation to the passed in object.

    Declaration

    Objective-C

    - (void)removeObject:(nonnull ObjectType)object;

    Swift

    func remove(_ object: ObjectType)

    Parameters

    object

    A PFObject object to add relation to.