Skip to content

Commit 518b3b3

Browse files
committed
update code documentation
1 parent 901b5b7 commit 518b3b3

File tree

3 files changed

+51
-19
lines changed

3 files changed

+51
-19
lines changed

Sources/FoundationEssentials/ProgressManager/ProgressManager+Properties+Accessors.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ extension ProgressManager {
341341
}
342342
}
343343

344-
/// Gets or sets custom integer properties.
344+
/// Gets or sets custom unsigned integer properties.
345345
///
346346
/// This subscript provides read-write access to custom progress properties where both the value
347347
/// and summary types are `UInt64`. If the property has not been set, the getter returns the
348348
/// property's default value.
349349
///
350-
/// - Parameter key: A key path to the custom integer property type.
350+
/// - Parameter key: A key path to the custom unsigned integer property type.
351351
public subscript<P: Property>(dynamicMember key: KeyPath<ProgressManager.Properties, P.Type>) -> UInt64 where P.Value == UInt64, P.Summary == UInt64 {
352352
get {
353353
if P.self == ProgressManager.Properties.TotalByteCount.self {
@@ -458,13 +458,13 @@ extension ProgressManager {
458458
}
459459
}
460460

461-
/// Gets or sets custom UInt64 properties.
461+
/// Gets or sets custom unsigned integer properties.
462462
///
463463
/// This subscript provides read-write access to custom progress properties where the value
464464
/// type is `UInt64` and the summary type is `[UInt64]`. If the property has not been set,
465465
/// the getter returns the property's default value.
466466
///
467-
/// - Parameter key: A key path to the custom UInt64 property type.
467+
/// - Parameter key: A key path to the custom unsigned integer property type.
468468
public subscript<P: Property>(dynamicMember key: KeyPath<ProgressManager.Properties, P.Type>) -> UInt64 where P.Value == UInt64, P.Summary == [UInt64] {
469469
get {
470470
if P.self == ProgressManager.Properties.Throughput.self {
@@ -495,13 +495,13 @@ extension ProgressManager {
495495
}
496496
}
497497

498-
/// Gets or sets custom Duration properties.
498+
/// Gets or sets custom duration properties.
499499
///
500500
/// This subscript provides read-write access to custom progress properties where the value
501501
/// type is `Duration` and the summary type is `Duration`. If the property has not been set,
502502
/// the getter returns the property's default value.
503503
///
504-
/// - Parameter key: A key path to the custom Duration property type.
504+
/// - Parameter key: A key path to the custom duration property type.
505505
public subscript<P: Property>(dynamicMember key: KeyPath<ProgressManager.Properties, P.Type>) -> Duration where P.Value == Duration, P.Summary == Duration {
506506
get {
507507
if P.self == ProgressManager.Properties.EstimatedTimeRemaining.self {
@@ -580,10 +580,10 @@ extension ProgressManager {
580580

581581
/// Returns a summary for a custom unsigned integer property across the progress subtree.
582582
///
583-
/// This method aggregates the values of a custom integer property from this progress manager
583+
/// This method aggregates the values of a custom unsigned integer property from this progress manager
584584
/// and all its children, returning a consolidated summary value.
585585
///
586-
/// - Parameter property: The type of the integer property to summarize. Must be a property
586+
/// - Parameter property: The type of the unsigned integer property to summarize. Must be a property
587587
/// where both the value and summary types are `UInt64`.
588588
/// - Returns: An `UInt64` summary value for the specified property.
589589
public func summary<P: Property>(of property: P.Type) -> P.Summary where P.Value == UInt64, P.Summary == UInt64 {
@@ -636,12 +636,12 @@ extension ProgressManager {
636636
return getUpdatedURLSummary(property: MetatypeWrapper(property))
637637
}
638638

639-
/// Returns a summary for a custom UInt64 property across the progress subtree.
639+
/// Returns a summary for a custom unsigned integer property across the progress subtree.
640640
///
641-
/// This method aggregates the values of a custom UInt64 property from this progress manager
641+
/// This method aggregates the values of a custom unsigned integer property from this progress manager
642642
/// and all its children, returning a consolidated summary value as an array of UInt64 values.
643643
///
644-
/// - Parameter property: The type of the UInt64 property to summarize. Must be a property
644+
/// - Parameter property: The type of the unsigned integer property to summarize. Must be a property
645645
/// where the value type is `UInt64` and the summary type is `[UInt64]`.
646646
/// - Returns: A `[UInt64]` summary value for the specified property.
647647
public func summary<P: Property>(of property: P.Type) -> P.Summary where P.Value == UInt64, P.Summary == [UInt64] {
@@ -653,12 +653,12 @@ extension ProgressManager {
653653
}
654654
}
655655

656-
/// Returns a summary for a custom Duration property across the progress subtree.
656+
/// Returns a summary for a custom duration property across the progress subtree.
657657
///
658-
/// This method aggregates the values of a custom Duration property from this progress manager
658+
/// This method aggregates the values of a custom duration property from this progress manager
659659
/// and all its children, returning a consolidated summary value.
660660
///
661-
/// - Parameter property: The type of the Duration property to summarize. Must be a property
661+
/// - Parameter property: The type of the duration property to summarize. Must be a property
662662
/// where the value type is `Duration` and the summary type is `Duration`.
663663
/// - Returns: A `Duration` summary value for the specified property.
664664
public func summary<P: Property>(of property: P.Type) -> P.Summary where P.Value == Duration, P.Summary == Duration {

Sources/FoundationEssentials/ProgressManager/ProgressReporter.swift

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
import Observation
1414

15-
@available(FoundationPreview 6.3, *)
1615
/// ProgressReporter is a wrapper for ProgressManager that carries information about ProgressManager.
1716
///
1817
/// It is read-only and can be added as a child of another ProgressManager.
18+
@available(FoundationPreview 6.3, *)
1919
@Observable public final class ProgressReporter: Sendable, Hashable, Equatable, CustomStringConvertible, CustomDebugStringConvertible {
2020

2121
/// The total units of work.
@@ -48,6 +48,10 @@ import Observation
4848
manager.isFinished
4949
}
5050

51+
/// A textual representation of the progress reporter.
52+
///
53+
/// This property provides a comprehensive description including the class name, object identifier,
54+
/// underlying progress manager details, and various progress metrics and properties.
5155
public var description: String {
5256
return """
5357
Class Name: ProgressReporter
@@ -67,6 +71,10 @@ import Observation
6771
"""
6872
}
6973

74+
/// A textual representation of the progress reporter suitable for debugging.
75+
///
76+
/// This property returns the same value as `description`, providing detailed information
77+
/// about the progress reporter's state for debugging purposes.
7078
public var debugDescription: String {
7179
return self.description
7280
}
@@ -83,7 +91,7 @@ import Observation
8391
/// This method aggregates the values of a custom integer property from the underlying progress manager
8492
/// and all its children, returning a consolidated summary value.
8593
///
86-
/// - Parameter property: The type of the double property to summarize. Must be a property
94+
/// - Parameter property: The type of the integer property to summarize. Must be a property
8795
/// where both the value and summary types are `Int`.
8896
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
8997
public func summary<P: ProgressManager.Property>(of property: P.Type) -> Int where P.Value == Int, P.Summary == Int {
@@ -126,14 +134,38 @@ import Observation
126134
return manager.summary(of: property)
127135
}
128136

137+
/// Returns a summary for the specified URL property across the progress subtree.
138+
///
139+
/// This method aggregates the values of a custom URL property from the underlying progress manager
140+
/// and all its children, returning a consolidated summary value.
141+
///
142+
/// - Parameter property: The type of the URL property to summarize. Must be a property
143+
/// where both the value and summary types are `URL?` and `[URL?]` respectively.
144+
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
129145
public func summary<P: ProgressManager.Property>(of property: P.Type) -> [URL?] where P.Value == URL?, P.Summary == [URL?] {
130146
return manager.summary(of: property)
131147
}
132148

149+
/// Returns a summary for the specified unsigned integer array property across the progress subtree.
150+
///
151+
/// This method aggregates the values of a custom unsigned integer property from the underlying progress manager
152+
/// and all its children, returning a consolidated summary value as an array.
153+
///
154+
/// - Parameter property: The type of the unsigned integer property to summarize. Must be a property
155+
/// where the value type is `UInt64` and the summary type is `[UInt64]`.
156+
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
133157
public func summary<P: ProgressManager.Property>(of property: P.Type) -> [UInt64] where P.Value == UInt64, P.Summary == [UInt64] {
134158
return manager.summary(of: property)
135159
}
136160

161+
/// Returns a summary for the specified duration property across the progress subtree.
162+
///
163+
/// This method aggregates the values of a custom duration property from the underlying progress manager
164+
/// and all its children, returning a consolidated summary value.
165+
///
166+
/// - Parameter property: The type of the duration property to summarize. Must be a property
167+
/// where both the value and summary types are `Duration`.
168+
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
137169
public func summary<P: ProgressManager.Property>(of property: P.Type) -> Duration where P.Value == Duration, P.Summary == Duration {
138170
return manager.summary(of: property)
139171
}

Sources/FoundationEssentials/ProgressManager/Subprogress.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
@available(FoundationPreview 6.3, *)
14-
/// Subprogress is a nested ~Copyable struct used to establish parent-child relationship between two instances of ProgressManager.
13+
/// Subprogress is used to establish parent-child relationship between two instances of `ProgressManager`.
1514
///
1615
/// Subprogress is returned from a call to `subprogress(assigningCount:)` by a parent ProgressManager.
17-
/// A child ProgressManager is then returned by calling`manager(totalCount:)` on a Subprogress.
16+
/// A child ProgressManager is then returned by calling `start(totalCount:)` on a Subprogress.
17+
@available(FoundationPreview 6.3, *)
1818
public struct Subprogress: ~Copyable, Sendable {
1919
internal var parent: ProgressManager
2020
internal var portionOfParent: Int

0 commit comments

Comments
 (0)