Protocols

The following protocols are available globally.

  • Objects that conform to the ParseUser protocol have a local representation of a user persisted to the Parse Data. This protocol inherits from the ParseObject protocol, and retains the same functionality of a ParseObject, but also extends it with various user specific methods, like authentication, signing up, and validation uniqueness.

    See more

    Declaration

    Swift

    public protocol ParseUser : ParseObject
  • Objects that conform to the ParseAuthentication protocol provide convenience implementations for using 3rd party authentication methods. The authentication methods supported by the Parse Server can be found here.

    See more

    Declaration

    Swift

    public protocol ParseAuthentication : Decodable, Encodable
  • Objects that conform to the ParseObject protocol have a local representation of data persisted to the Parse cloud. This is the main protocol that is used to interact with objects in your app.

    The Swift SDK is designed for your ParseObjects to be “value types” (structs). If you are using value types the the compiler will assist you with conforming to ParseObject protocol. If you are thinking of using reference types, see the warning.

    After a ParseObjectis saved/created to a Parse Server. It is recommended to conduct the rest of your updates on a mergeable copy of your ParseObject. This allows a subset of the fields to be updated (PATCH) of an object as oppose to replacing all of the fields of an object (PUT). This reduces the amount of data sent between client and server when using save, saveAll, update, updateAll, replace, replaceAll, to update objects.

    Important

    It is required that all added properties be optional properties so they can eventually be used as Parse Pointer‘s. If a developer really wants to have a required key, they should require it on the server-side or create methods to check the respective properties on the client-side before saving objects. See here for more information on the reasons why. See the Playgrounds for an example.

    Important

    To take advantage of mergeable, the developer should implement the merge method in every ParseObject.

    Warning

    If you plan to use “reference types” (classes), you are using at your risk as this SDK is not designed for reference types and may have unexpected behavior when it comes to threading. You will also need to implement your own == method to conform to Equatable along with with the hash method to conform to Hashable. It is important to note that for unsaved ParseObject’s, you won’t be able to rely on objectId for Equatable and Hashable as your unsaved objects won’t have this value yet and is nil. A possible way to address this is by creating a UUID for your objects locally and relying on that for Equatable and Hashable, otherwise it’s possible you will get “circular dependency errors” depending on your implementation.

    Note

    If you plan to use custom encoding/decoding, be sure to add objectId, createdAt, updatedAt, and ACL to your ParseObject CodingKeys.
    See more

    Declaration

    Swift

    public protocol ParseObject: Objectable,
                                 Fetchable,
                                 Savable,
                                 Deletable,
                                 Identifiable,
                                 Hashable,
                                 CustomDebugStringConvertible,
                                 CustomStringConvertible
  • Receive/respond to notifications from the ParseLiveQuery Server.

    See more

    Declaration

    Swift

    public protocol ParseLiveQueryDelegate : AnyObject
  • This protocol describes the interface for handling events from a ParseLiveQuery client. You can use this protocol on any custom class of yours, instead of Subscription or SubscriptionCallback, if it fits your use case better.

    See more

    Declaration

    Swift

    public protocol QuerySubscribable : AnyObject
  • Objects that conform to the ParseInstallation protocol have a local representation of an installation persisted to the Parse cloud. This protocol inherits from the ParseObject protocol, and retains the same functionality of a ParseObject, but also extends it with installation-specific fields and related immutability and validity checks.

    A valid ParseInstallation can only be instantiated via current because the required identifier fields are readonly. The timeZone is also a readonly property which is automatically updated to match the device’s time zone when the ParseInstallation is saved, thus these fields might not reflect the latest device state if the installation has not recently been saved.

    ParseInstallations which have a valid deviceToken and are saved to the Parse Server can be used to target push notifications. Use setDeviceToken to set the deviceToken properly.

    Warning

    If the use of badge is desired, it should be retrieved by using UIKit, AppKit, etc. and stored in ParseInstallation.badge before saving/updating the installation.

    Warning

    Linux developers should set appName, appIdentifier, and appVersion manually as ParseSwift doesn’t have access to Bundle.main.

    See more

    Declaration

    Swift

    public protocol ParseInstallation : ParseObject
  • Objects that conform to the ParseRole protocol represent a Role on the Parse Server. ParseRole‘s represent groupings of ParseUser objects for the purposes of granting permissions (e.g. specifying a ParseACL for a ParseObject). Roles are specified by their sets of child users and child roles, all of which are granted any permissions that the parent role has. Roles must have a name (which cannot be changed after creation of the role), and must specify a ParseACL.

    See more

    Declaration

    Swift

    public protocol ParseRole : ParseObject
  • ParseSession is a local representation of a session. This protocol conforms to ParseObject and retains the same functionality.

    See more

    Declaration

    Swift

    public protocol ParseSession : ParseObject
  • This protocol describes the interface for creating a view model for ParseCloud functions and jobs. You can use this protocol on any custom class of yours, instead of CloudViewModel, if it fits your use case better.

    See more

    Declaration

    Swift

    public protocol CloudObservable : ObservableObject
  • The base protocol for a ParseObject.

    Note

    You should not use this directly and instead use ParseObject.
    See more

    Declaration

    Swift

    public protocol Objectable : ParseType, Decodable
  • Conform to this protocol to add the required properties to your ParseObject for using QueryConstraint.matchesText() and Query.sortByTextScore().

    Note

    In order to sort you must use Query.sortByTextScore(). To retrieve the weight/rank, access the “score” property of your ParseObject.
    See more

    Declaration

    Swift

    public protocol ParseQueryScorable
  • This protocol describes the interface for creating a view model for a Query. You can use this protocol on any custom class of yours, instead of QueryViewModel, if it fits your use case better.

    See more

    Declaration

    Swift

    public protocol QueryObservable : ObservableObject
  • A store that supports key/value storage. It should be able to handle any object that conforms to encodable and decodable.

    See more

    Declaration

    Swift

    public protocol ParseKeyValueStore
  • Objects that conform to the ParseCloud protocol are able to call Parse Cloud Functions and Jobs. An object should be instantiated for each function and job type. When conforming to ParseCloud, any properties added will be passed as parameters to your Cloud Function or Job.

    See more

    Declaration

    Swift

    public protocol ParseCloud : CloudType, ParseType, Hashable
  • Objects that conform to the ParseConfig protocol are able to access the Config on the Parse Server. When conforming to ParseConfig, any properties added can be retrieved by the client or updated on the server.

    See more

    Declaration

    Swift

    public protocol ParseConfig: ParseType,
                                 Decodable,
                                 CustomDebugStringConvertible,
                                 CustomStringConvertible