PCKSynchronizable
public protocol PCKSynchronizable
Objects that conform to the PCKSynchronizable protocol are synchronized between the OCKStore and the Parse Cloud.
In order to synchronize objects, they must also conform to either PCKObjectable or PCKVersionable. For examples,
see PCKPatient, PCKCarePlan, PCKTask, PCKContact, and PCKOutcome.
-
Adds an object that conforms to PCKSynchronizable to the Parse Server and keeps it synchronized with the CareKitStore.
Declaration
Swift
func addToCloud(completion: @escaping (Result<PCKSynchronizable, Error>) -> Void)Parameters
completionThe block to execute. It should have the following argument signature:
(Result<PCKSynchronizable,Error>). -
Updates an object that conforms to PCKSynchronizable that is already on the Parse Server and keeps it synchronized with the CareKitStore.
Declaration
Swift
func updateCloud(completion: @escaping (Result<PCKSynchronizable, Error>) -> Void)Parameters
overwriteRemoteWhether data should be overwritten if it’s already present on the Parse Server.
completionThe block to execute. It should have the following argument signature:
(Result<PCKSynchronizable,Error>). -
Creates a new ParseCareKit object from a specified CareKit entity.
Declaration
Swift
func new(with careKitEntity: OCKEntity) throws -> SelfParameters
withThe CareKit entity used to create the new ParseCareKit object.
Return Value
Returns a new version of
Self -
Fetch all objects from the server that have been made on since the last time synchronization was performed.
Warning
The
mergeRevisionclosure should never be called in parallel. Wait until one merge has completed before starting another.Declaration
Swift
func pullRevisions(since localClock: Int, cloudClock: OCKRevisionRecord.KnowledgeVector, remoteID: String, mergeRevision: @escaping (Result<OCKRevisionRecord, ParseError>) -> Void)Parameters
sinceThe last time a synchronization was performed locally
cloudClockThe server clock represented as a vector.
mergeRevisionA closure that can be called multiple times to merge revisions.
-
Push a revision from a device up to the server.
Declaration
Swift
func pushRevision(cloudClock: Int, remoteID: String, completion: @escaping (Error?) -> Void)Parameters
cloudClockThe current clock value of the revision.
completionA closure that should be called once the push completes.
View on GitHub
Install in Dash
PCKSynchronizable Protocol Reference