Skip to content

Commit 901b5b7

Browse files
committed
sync ProgressManager code documentation
1 parent 1559447 commit 901b5b7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Sources/FoundationEssentials/ProgressManager/ProgressManager.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ internal import OrderedCollections
2121
internal import _FoundationCollections
2222
#endif
2323

24-
@available(FoundationPreview 6.3, *)
2524
/// An object that conveys ongoing progress to the user for a specified task.
25+
@available(FoundationPreview 6.3, *)
2626
@Observable public final class ProgressManager: Sendable {
2727

2828
internal let state: Mutex<State>
@@ -38,7 +38,6 @@ internal import _FoundationCollections
3838
}
3939

4040
/// The completed units of work.
41-
/// If `self` is indeterminate, the value will be 0.
4241
public var completedCount: Int {
4342
_$observationRegistrar.access(self, keyPath: \.completedCount)
4443
return state.withLock { state in
@@ -48,7 +47,7 @@ internal import _FoundationCollections
4847

4948
/// The proportion of work completed.
5049
/// This takes into account the fraction completed in its children instances if children are present.
51-
/// If `self` is indeterminate, the value will be 0.
50+
/// If `self` is indeterminate, the value will be 0.0.
5251
public var fractionCompleted: Double {
5352
_$observationRegistrar.access(self, keyPath: \.fractionCompleted)
5453
return state.withLock { state in
@@ -151,7 +150,7 @@ internal import _FoundationCollections
151150
/// If the `Subprogress` is not converted into a `ProgressManager` (for example, due to an error or early return),
152151
/// then the assigned count is marked as completed in the parent `ProgressManager`.
153152
///
154-
/// - Parameter count: Units, which is a portion of `totalCount`delegated to an instance of `Subprogress`.
153+
/// - Parameter count: The portion of `totalCount` to be delegated to the `Subprogress`.
155154
/// - Returns: A `Subprogress` instance.
156155
public func subprogress(assigningCount portionOfParent: Int) -> Subprogress {
157156
precondition(portionOfParent > 0, "Giving out zero units is not a valid operation.")
@@ -160,9 +159,12 @@ internal import _FoundationCollections
160159
}
161160

162161
/// Adds a `ProgressReporter` as a child, with its progress representing a portion of `self`'s progress.
162+
///
163+
/// If a cycle is detected, this will cause a crash at runtime.
164+
///
163165
/// - Parameters:
164-
/// - reporter: A `ProgressReporter` instance.
165166
/// - count: Units, which is a portion of `totalCount`delegated to an instance of `Subprogress`.
167+
/// - reporter: A `ProgressReporter` instance.
166168
public func assign(count: Int, to reporter: ProgressReporter) {
167169
precondition(isCycle(reporter: reporter) == false, "Creating a cycle is not allowed.")
168170

@@ -407,6 +409,7 @@ extension ProgressManager: Hashable, Equatable {
407409

408410
@available(FoundationPreview 6.3, *)
409411
extension ProgressManager: CustomStringConvertible, CustomDebugStringConvertible {
412+
/// A description.
410413
public var description: String {
411414
return """
412415
Class Name: ProgressManager
@@ -425,6 +428,7 @@ extension ProgressManager: CustomStringConvertible, CustomDebugStringConvertible
425428
"""
426429
}
427430

431+
/// A debug description.
428432
public var debugDescription: String {
429433
return self.description
430434
}

0 commit comments

Comments
 (0)