Generic Instance Method 総称体インスタンスメソッド

performAsCurrent(withPendingUnitCount:using:)

Retrieves the current thread’s progress object, executes the specified block, and increments the progress object by the specified units of work. 現在のスレッドのもつ進捗オブジェクトを取って来ます、指定されたプロックを遂行します、そして進捗オブジェクトをその指定された仕事の単位だけ漸増します。

Declaration 宣言

func performAsCurrent<ReturnType>(withPendingUnitCount unitCount: Int64, using work: () throws -> ReturnType) rethrows -> ReturnType

Parameters パラメータ

unitCount

The number of units of work to increment for the current progress object. This number represents the portion of work that is complete in relation to the total number of units of work for the current thread’s progress object. The units of work for this parameter must be the same units of work as the current progress object’s totalUnitCount property.

work

A block that wraps the work you specify to complete for incrementing the current progress.

Return Value 戻り値

The return type and value of the block that you specify for the work parameter.

Discussion 議論

Use this function as a convenience method to wrap an existing method or block to increment the current progress object. This function retrieves the current progress object, does the work you specify in the work block, and returns the value from that block. When the block is complete, this function increments the current progress object. This function is the same as calling becomeCurrent(withPendingUnitCount:), doing the work you specify in the block, and calling resignCurrent().

See Also 参照

Accessing the Current Progress Object 現在の進捗オブジェクトにアクセスする