Protocols
The following protocols are available globally.
-
Objects that conform to the
See moreParseUser
protocol have a local representation of a user persisted to the Parse Data. This protocol inherits from theParseObject
protocol, and retains the same functionality of aParseObject
, but also extends it with various user specific methods, like authentication, signing up, and validation uniqueness.Declaration
Swift
public protocol ParseUser : ParseObject
-
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
ParseObject
s to be “value types” (structs). If you are using value types the the compiler will assist you with conforming toParseObject
protocol. If you are thinking of using reference types, see the warning.After a
ParseObject
is saved/created to a Parse Server. It is recommended to conduct the rest of your updates on amergeable
copy of yourParseObject
. 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 usingsave
,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 ParsePointer
‘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 ofmergeable
, the developer should implement themerge
method in everyParseObject
.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 toEquatable
along with with thehash
method to conform toHashable
. It is important to note that for unsavedParseObject
’s, you won’t be able to rely onobjectId
forEquatable
andHashable
as your unsaved objects won’t have this value yet and is nil. A possible way to address this is by creating aUUID
for your objects locally and relying on that forEquatable
andHashable
, 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 addobjectId
,createdAt
,updatedAt
, andACL
to yourParseObject
CodingKeys
.Declaration
Swift
public protocol ParseObject: Objectable, Fetchable, Savable, Deletable, Identifiable, Hashable, CustomDebugStringConvertible, CustomStringConvertible
-
Receive/respond to notifications from the ParseLiveQuery Server.
See moreDeclaration
Swift
public protocol ParseLiveQueryDelegate : AnyObject
-
This protocol describes the interface for handling events from a
See moreParseLiveQuery
client. You can use this protocol on any custom class of yours, instead ofSubscription
orSubscriptionCallback
, if it fits your use case better.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 theParseObject
protocol, and retains the same functionality of aParseObject
, 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. ThetimeZone
is also a readonly property which is automatically updated to match the device’s time zone when theParseInstallation
is saved, thus these fields might not reflect the latest device state if the installation has not recently been saved.ParseInstallation
s which have a validdeviceToken
and are saved to the Parse Server can be used to target push notifications. UsesetDeviceToken
to set thedeviceToken
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
, andappVersion
manually asParseSwift
doesn’t have access to Bundle.main.Declaration
Swift
public protocol ParseInstallation : ParseObject
-
Objects that conform to the
See moreParseRole
protocol represent a Role on the Parse Server.ParseRole
‘s represent groupings ofParseUser
objects for the purposes of granting permissions (e.g. specifying aParseACL
for aParseObject
). 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 aParseACL
.Declaration
Swift
public protocol ParseRole : ParseObject
-
See moreParseSession
is a local representation of a session. This protocol conforms toParseObject
and retains the same functionality.Declaration
Swift
public protocol ParseSession : ParseObject
-
This protocol describes the interface for creating a view model for
See moreParseCloud
functions and jobs. You can use this protocol on any custom class of yours, instead ofCloudViewModel
, if it fits your use case better.Declaration
Swift
public protocol CloudObservable : ObservableObject
-
The base protocol for a
ParseObject
.Note
You should not use this directly and instead useParseObject
.Declaration
Swift
public protocol Objectable : ParseType, Decodable
-
Conform to this protocol to add the required properties to your
ParseObject
for usingQueryConstraint.matchesText()
andQuery.sortByTextScore()
.Note
In order to sort you must useQuery.sortByTextScore()
. To retrieve the weight/rank, access the “score” property of yourParseObject
.Declaration
Swift
public protocol ParseQueryScorable
-
This protocol describes the interface for creating a view model for a
See moreQuery
. You can use this protocol on any custom class of yours, instead ofQueryViewModel
, if it fits your use case better.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 moreDeclaration
Swift
public protocol ParseKeyValueStore
-
Objects that conform to the
See moreParseCloud
protocol are able to call Parse Cloud Functions and Jobs. An object should be instantiated for each function and job type. When conforming toParseCloud
, any properties added will be passed as parameters to your Cloud Function or Job.Declaration
Swift
public protocol ParseCloud : CloudType, ParseType, Hashable
-
Objects that conform to the
See moreParseConfig
protocol are able to access the Config on the Parse Server. When conforming toParseConfig
, any properties added can be retrieved by the client or updated on the server.Declaration
Swift
public protocol ParseConfig: ParseType, Decodable, CustomDebugStringConvertible, CustomStringConvertible