---
title: "discreteProgress(totalUnitCount:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/progress/discreteprogress(totalunitcount:)"
---

# discreteProgress(totalUnitCount:)

Creates and returns a progress instance with the specified unit count that isn’t part of any existing progress tree.

## Declaration

```swift
class func discreteProgress(totalUnitCount unitCount: Int64) -> Progress
```

## Parameters

- `unitCount`: The total number of units of work to assign to the progress instance.

## Return Value

Return Value A new progress instance with its containing progress object set to nil.

## Discussion

Discussion Use this method to create the top-level progress object that your custom classes return. The receiver of the returned progress object can add it to a progress tree using Progress/addChild(_:withPendingUnitCount:). You’re responsible for updating the progress count of the created progress object. You can invoke this method on one thread and then message the returned NSProgress 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

- [init(parent:userInfo:)](foundation/progress/init(parent:userinfo:).md)
- [init(totalUnitCount:)](foundation/progress/init(totalunitcount:).md)
- [init(totalUnitCount:parent:pendingUnitCount:)](foundation/progress/init(totalunitcount:parent:pendingunitcount:).md)
