Sunday, November 8, 2026
HomeiOS Developmentios - Can asynchronous operations be used with `progress` on OperationQueue?

ios – Can asynchronous operations be used with `progress` on OperationQueue?

[ad_1]

Beginning in iOS13, one can monitor the progress of an OperationQueue utilizing the progress property. The documentation states that solely operations that don’t override begin() rely when monitoring progress. Nevertheless, asynchronous operations should override begin() and never name tremendous() in response to the documentation.

Does this imply asynchronous operations and progress are mutually unique (i.e. solely synchronous operations can be utilized with progress)? This looks as if an enormous limitation if that is so.

In my very own mission, I eliminated my override of begin() and every little thing seems to work okay (e.g. dependencies are solely began when isFinished is ready to true internally in my async operation base class). BUT, this appears dangerous since Operation explicitly states to override begin().

Ideas?

Documentaiton references:

https://developer.apple.com/documentation/basis/operationqueue/3172535-progress

By default, OperationQueue doesn’t report progress till totalUnitCount is ready. When totalUnitCount is ready, the queue begins reporting progress. Every operation within the queue contributes one unit of completion to the general progress of the queue for operations which might be completed by the tip of essential(). Operations that override begin() and don’t invoke tremendous don’t contribute to the queue’s progress.

https://developer.apple.com/documentation/basis/operation/1416837-start

In case you are implementing a concurrent operation, it’s essential to override this methodology and use it to provoke your operation. Your customized implementation should not name tremendous at any time. Along with configuring the execution surroundings on your process, your implementation of this methodology should additionally monitor the state of the operation and supply acceptable state transitions.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments