<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Progress/init(totalUnitCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSProgress(cm)progressWithTotalUnitCount:"
  },
  "title" : "init(totalUnitCount:)"
}
-->

# init(totalUnitCount:)

Creates and returns a progress instance.

```
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`](/documentation/Foundation/Progress/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`](/documentation/Foundation/Progress/completedUnitCount) or [`isCancelled`](/documentation/Foundation/Progress/isCancelled) property in the loop that does the work.

You can invoke this method on one thread and then message the returned [`Progress`](/documentation/Foundation/Progress) on another thread. For example, you can capture the created progress instance in a block that you pass to <doc://com.apple.documentation/documentation/Dispatch/dispatch_async>. In that block, you can invoke methods like [`becomeCurrent(withPendingUnitCount:)`](/documentation/Foundation/Progress/becomeCurrent(withPendingUnitCount:)) or [`resignCurrent()`](/documentation/Foundation/Progress/resignCurrent()), and set the [`completedUnitCount`](/documentation/Foundation/Progress/completedUnitCount) or [`isCancelled`](/documentation/Foundation/Progress/isCancelled) properties as your app finishes its work.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)