Initializer

init(totalUnitCount:)

Creates and returns a progress instance. ある進捗インスタンスを作成します。

Declaration 宣言

init(totalUnitCount unitCount: Int64)

Parameters パラメータ

unitCount

The total number of units of work to assign to the progress instance.

Discussion 議論

If a current progress object exists, the initializer uses it to set the value of the totalUnitCount property.

In many cases, you can precede code that does a substantial amount of work with an invocation of this method, then repeatedly set the completedUnitCount or isCancelled property in the loop that does the work.

You can invoke this method on one thread and then message the returned Progress on another thread. For example, you can capture the created progress instance in a block that you pass to dispatch_async(_:_:). In that block, you can invoke methods like becomeCurrent(withPendingUnitCount:) or resignCurrent(), and set the completedUnitCount or isCancelled properties as your app finishes its work.

See Also 参照

Creating Progress Objects 進捗オブジェクトを作成する