PCKVersionable
public protocol PCKVersionable : PCKObjectable, PCKSynchronizable
Objects that conform to the PCKVersionable
protocol are Parse interpretations of OCKVersionedObjectCompatible
objects.
-
The UUID of the previous version of this object, or nil if there is no previous version. The UUIDs are in no particular order.
Declaration
Swift
var previousVersionUUIDs: [UUID]? { get set }
-
The UUID of the next version of this object, or nil if there is no next version. The UUIDs are in no particular order.
Declaration
Swift
var nextVersionUUIDs: [UUID]? { get set }
-
The date that this version of the object begins to take precedence over the previous version. Often this will be the same as the
createdDate
, but is not required to be.Declaration
Swift
var effectiveDate: Date? { get set }
-
The date on which this object was marked deleted. Note that objects are never actually deleted, but rather they are marked deleted and will no longer be returned from queries.
Declaration
Swift
var deletedDate: Date? { get set }
-
find(for:
Extension method, asynchronousoptions: ) Find versioned objects asynchronously like
fetch
in CareKit. Finds the newest version that has not been deleted.Declaration
Swift
func find(for date: Date, options: API.Options = []) async throws -> [Self]
Parameters
for
The date the objects are active.
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of
.main
.throws
ParseError
.Return Value
An array of objects matching the query.
-
save(options:
Extension method, asynchronous) Saves a
PCKVersionable
object.Declaration
Swift
func save(options: API.Options = []) async throws -> Self
Parameters
uuid
The UUID to search for.
options
A set of header options sent to the server. Defaults to an empty set.
relatedObject
An object that has the same
uuid
as the one being searched for.throws
ParseError
.Return Value
The saved version.
-
findPublisher(for:
Extension methodoptions: ) Find versioned objects asynchronously like
fetch
in CareKit. Finds the newest version that has not been deleted. Publishes when complete.Declaration
Swift
func findPublisher(for date: Date, options: API.Options = []) -> Future<[Self], ParseError>
Parameters
for
The date the objects are active.
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Future<[Self],ParseError>
. -
savePublisher(for:
Extension methodoptions: ) Saves a
PCKVersionable
object. asynchronously. Publishes when complete.Declaration
Swift
func savePublisher(for date: Date, options: API.Options = []) -> Future<Self, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Future<[Self],ParseError>
. -
copyVersionedValues(from:
Extension method) Copies the common values of another PCKVersionable object.
Declaration
Swift
public mutating func copyVersionedValues(from other: Self)
Parameters
from
The PCKVersionable object to copy from.
-
save(options:
Extension methodcompletion: ) Saves a
PCKVersionable
object.Declaration
Swift
public func save(options: API.Options = [], completion: @escaping(Result<PCKSynchronizable, Error>) -> Void)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
completion
The block to execute. It should have the following argument signature:
(Result<PCKSynchronizable,Error>)
.
-
query(for:
Extension method) Querying versioned objects just like CareKit. Creates a query that finds the newest version that has not been deleted. This is the query used by
find(for date: Date)
. Use this query to build from if you desire a more intricate query.Declaration
Swift
public static func query(for date: Date) -> Query<Self>
Parameters
for
The date the object is active.
Return Value
Query<Self>
. -
find(for:
Extension methodoptions: callbackQueue: completion: ) Find versioned objects asynchronously like
fetch
in CareKit. Finds the newest version that has not been deleted.Declaration
Swift
public func find(for date: Date, options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping(Result<[Self], ParseError>) -> Void)
Parameters
for
The date the objects are active.
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of
.main
.completion
The block to execute. It should have the following argument signature:
(Result<[Self],ParseError>)
.
-
encodeVersionable(to:
Extension method) Encodes the PCKVersionable properties of the object
Declaration
Swift
public func encodeVersionable(to encoder: Encoder) throws
Parameters
to
the encoder the properties should be encoded to.