AmplifyInProcessReportingOperation
open class AmplifyInProcessReportingOperation<
Request: AmplifyOperationRequest,
InProcess,
Success,
Failure: AmplifyError
>: AmplifyOperation<Request, Success, Failure>
An AmplifyOperation that emits InProcess values intermittently during the operation.
Unlike a regular AmplifyOperation
, which emits a single Result at the completion of the operation’s work, an
AmplifyInProcessReportingOperation
may emit intermediate values while its work is ongoing. These values could be
incidental to the operation (such as a Storage.downloadFile
operation reporting Progress values periodically as
the download proceeds), or they could be the primary delivery mechanism for an operation (such as a
GraphQLSubscriptionOperation
‘s emitting new subscription values).
-
Declaration
Swift
public typealias InProcess = InProcess
-
Declaration
Swift
public init(categoryType: CategoryType, eventName: HubPayloadEventName, request: Request, inProcessListener: InProcessListener? = nil, resultListener: ResultListener? = nil)
-
Classes that override this method must emit a completion to the
inProcessPublisher
upon cancellationDeclaration
Swift
open override func cancel()
-
Invokes
super.dispatch()
. On iOS 13+, this method first publishes a.finished
completion on the in-process publisher.Declaration
Swift
public override func dispatch(result: OperationResult)
Parameters
result
The OperationResult to dispatch to the hub as part of the HubPayload
-
Convenience typealias for the
inProcessListener
callback submitted during Operation creationDeclaration
Swift
typealias InProcessListener = (InProcess) -> Void
-
Dispatches an event to the hub. Internally, creates an
AmplifyOperationContext
object from the operation’sid
, andrequest
Declaration
Swift
func dispatchInProcess(data: InProcess)
Parameters
result
The OperationResult to dispatch to the hub as part of the HubPayload
-
Removes the listener that was registered during operation instantiation
Declaration
Swift
func removeInProcessResultListener()
-
Publishes in-process updates
Declaration
Swift
var inProcessPublisher: AnyPublisher<InProcess, Never> { get }