QueryObservable
public protocol QueryObservable : ObservableObject
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.
-
The
ParseObject
associated with this view model.Declaration
Swift
associatedtype Object : ParseObject
-
Finds objects asynchronously based on the constructed query and updates the view model when complete.
Declaration
Swift
func find(options: API.Options)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
-
Retrieves asynchronously a complete list of
ParseObject
‘s that satisfy this query and updates the view model when complete.Warning
The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.Declaration
Swift
func findAll(batchLimit: Int?, options: API.Options)
Parameters
batchLimit
The maximum number of objects to send in each batch. If the items to be batched.
options
A set of header options sent to the server. Defaults to an empty set.
-
Gets an object asynchronously and updates the view model when complete.
Warning
This method mutates the query. It will reset the limit to1
.Declaration
Swift
func first(options: API.Options)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
-
Counts objects synchronously based on the constructed query and updates the view model when complete.
Declaration
Swift
func count(options: API.Options)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
-
Executes an aggregate query asynchronously and updates the view model when complete.
Requires
.useMasterKey
has to be available.Warning
This hasn’t been tested thoroughly.Declaration
Swift
func aggregate(_ pipeline: [[String: Encodable]], options: API.Options)
Parameters
pipeline
A pipeline of stages to process query.
options
A set of header options sent to the server. Defaults to an empty set.