PFSubclassing

Objective-C

@protocol PFSubclassing <NSObject>

Swift

protocol PFSubclassing : NSObjectProtocol

If a subclass of PFObject conforms to PFSubclassing and calls PFObject.+registerSubclass, Parse framework will be able to use that class as the native class for a Parse cloud object.

Classes conforming to this protocol should subclass PFObject and include PFObject+Subclass.h in their implementation file. This ensures the methods in the Subclass category of PFObject are exposed in its subclasses only.

  • The name of the class as seen in the REST API.

    Declaration

    Objective-C

    + (nonnull NSString *)parseClassName;

    Swift

    static func parseClassName() -> String
  • Creates a reference to an existing PFObject for use in creating associations between PFObjects.

    Calling PFObject.dataAvailable on this object will return NO until PFObject. has been called. No network request will be made. A default implementation is provided by PFObject which should always be sufficient.

    Declaration

    Objective-C

    + (nonnull instancetype)objectWithoutDataWithObjectId:
        (nullable NSString *)objectId;

    Swift

    optional static func objectWithoutData(withObjectId objectId: String?) -> Self

    Parameters

    objectId

    The object id for the referenced object.

    Return Value

    A new PFObject without data.

  • Create a query which returns objects of this type.

    A default implementation is provided by PFObject which should always be sufficient.

    Declaration

    Objective-C

    + (nullable PFQuery *)query;

    Swift

    optional static func query() -> PFQuery?
  • Returns a query for objects of this type with a given predicate.

    A default implementation is provided by PFObject which should always be sufficient.

    See

    [PFQuery queryWithClassName:predicate:]

    Declaration

    Objective-C

    + (nullable PFQuery *)queryWithPredicate:(nullable NSPredicate *)predicate;

    Swift

    optional static func query(with predicate: NSPredicate?) -> PFQuery?

    Parameters

    predicate

    The predicate to create conditions from.

    Return Value

    An instance of PFQuery.

  • Lets Parse know this class should be used to instantiate all objects with class type parseClassName.

    Warning

    This method must be called before Parse.+setApplicationId:clientKey:.

    Declaration

    Objective-C

    + (void)registerSubclass;

    Swift

    optional static func registerSubclass()