ParseCloud
public protocol ParseCloud : CloudType, ParseType, Hashable
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.
-
The name of the function or job.
Declaration
Swift
var functionJobName: String { get set }
-
viewModel
Extension methodCreates a view model for this CloudCode. Suitable for
ObjectObserved
as the view model can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM.Declaration
Swift
var viewModel: CloudViewModel<Self> { get }
-
viewModel(_:
Extension method) Creates a view model for this CloudCode. Suitable for
ObjectObserved
as the view model can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM.Declaration
Swift
static func viewModel(_ cloudCode: Self) -> CloudViewModel<Self>
Parameters
query
Any query.
Return Value
The view model for this query.
-
runFunction(options:
Extension method, asynchronous) Calls a Cloud Code function asynchronously and returns a result of it’s execution.
Throws
An error of typeParseError
.Declaration
Swift
func runFunction(options: API.Options = []) async throws -> ReturnType
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
The return type.
-
startJob(options:
Extension method, asynchronous) Starts a Cloud Code Job asynchronously and returns a result with the jobStatusId of the job.
Throws
An error of typeParseError
.Declaration
Swift
func startJob(options: API.Options = []) async throws -> ReturnType
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
The return type.
-
runFunctionPublisher(options:
Extension method) Calls a Cloud Code function asynchronously and returns a result of it’s execution. Publishes when complete.
Declaration
Swift
func runFunctionPublisher(options: API.Options = []) -> Future<ReturnType, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
startJobPublisher(options:
Extension method) Starts a Cloud Code Job asynchronously and returns a result with the jobStatusId of the job. Publishes when complete.
Declaration
Swift
func startJobPublisher(options: API.Options = []) -> Future<ReturnType, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
runFunction(options:
Extension method) Calls a Cloud Code function synchronously and returns a result of it’s execution.
Throws
An error of typeParseError
.Declaration
Swift
public func runFunction(options: API.Options = []) throws -> ReturnType
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns a
Decodable
type. -
runFunction(options:
Extension methodcallbackQueue: completion: ) Calls a Cloud Code function asynchronously and returns a result of it’s execution.
Declaration
Swift
public func runFunction(options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<ReturnType, ParseError>) -> Void)
Parameters
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
A block that will be called when the Cloud Code completes or fails. It should have the following argument signature:
(Result<ReturnType, ParseError>)
.
-
startJob(options:
Extension method) Starts a Cloud Code Job synchronously and returns a result with the jobStatusId of the job. - parameter options: A set of header options sent to the server. Defaults to an empty set. - returns: Returns a
Decodable
type.Declaration
Swift
public func startJob(options: API.Options = []) throws -> ReturnType
-
startJob(options:
Extension methodcallbackQueue: completion: ) Starts a Cloud Code Job asynchronously and returns a result with the jobStatusId of the job.
Declaration
Swift
public func startJob(options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<ReturnType, ParseError>) -> Void)
Parameters
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
A block that will be called when the Cloud Code Job completes or fails. It should have the following argument signature:
(Result<ReturnType, ParseError>)
.
-
debugDescription
Extension methodDeclaration
Swift
public var debugDescription: String { get }
-
description
Extension methodDeclaration
Swift
public var description: String { get }