@@ -601,7 +601,13 @@ extension ProgressManager {
601
601
/// - Returns: An `Int` summary value for the specified property.
602
602
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == Int , P. Summary == Int {
603
603
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
604
- return getUpdatedIntSummary ( property: MetatypeWrapper ( property) )
604
+ if property. self == ProgressManager . Properties. TotalFileCount. self {
605
+ return getUpdatedFileCount ( type: . total)
606
+ } else if property. self == ProgressManager . Properties. CompletedFileCount. self {
607
+ return getUpdatedFileCount ( type: . completed)
608
+ } else {
609
+ return getUpdatedIntSummary ( property: MetatypeWrapper ( property) )
610
+ }
605
611
}
606
612
607
613
/// Returns a summary for a custom unsigned integer property across the progress subtree.
@@ -614,7 +620,13 @@ extension ProgressManager {
614
620
/// - Returns: An `UInt64` summary value for the specified property.
615
621
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == UInt64 , P. Summary == UInt64 {
616
622
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
617
- return getUpdatedUInt64Summary ( property: MetatypeWrapper ( property) )
623
+ if property. self == ProgressManager . Properties. TotalByteCount. self {
624
+ return getUpdatedByteCount ( type: . total)
625
+ } else if property. self == ProgressManager . Properties. CompletedByteCount. self {
626
+ return getUpdatedByteCount ( type: . completed)
627
+ } else {
628
+ return getUpdatedUInt64Summary ( property: MetatypeWrapper ( property) )
629
+ }
618
630
}
619
631
620
632
/// Returns a summary for a custom double property across the progress subtree.
@@ -666,7 +678,11 @@ extension ProgressManager {
666
678
/// - Returns: A `[UInt64]` summary value for the specified property.
667
679
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == UInt64 , P. Summary == [ UInt64 ] {
668
680
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
669
- return getUpdatedUInt64ArraySummary ( property: MetatypeWrapper ( property) )
681
+ if property. self == ProgressManager . Properties. Throughput. self {
682
+ return getUpdatedThroughput ( )
683
+ } else {
684
+ return getUpdatedUInt64ArraySummary ( property: MetatypeWrapper ( property) )
685
+ }
670
686
}
671
687
672
688
/// Returns a summary for a custom Duration property across the progress subtree.
@@ -679,66 +695,10 @@ extension ProgressManager {
679
695
/// - Returns: A `Duration` summary value for the specified property.
680
696
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == Duration , P. Summary == Duration {
681
697
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
682
- return getUpdatedDurationSummary ( property: MetatypeWrapper ( property) )
683
- }
684
-
685
- /// Returns the total file count across the progress subtree.
686
- ///
687
- /// - Parameter property: The `TotalFileCount` property type.
688
- /// - Returns: The sum of all total file counts across the entire progress subtree.
689
- public func summary( of property: ProgressManager . Properties . TotalFileCount . Type ) -> Int {
690
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
691
- return getUpdatedFileCount ( type: . total)
692
- }
693
-
694
- /// Returns the completed file count across the progress subtree.
695
- ///
696
- /// - Parameter property: The `CompletedFileCount` property type.
697
- /// - Returns: The sum of all completed file counts across the entire progress subtree.
698
- public func summary( of property: ProgressManager . Properties . CompletedFileCount . Type ) -> Int {
699
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
700
- return getUpdatedFileCount ( type: . completed)
701
- }
702
-
703
- /// Returns the total byte count across the progress subtree.
704
- ///
705
- /// - Parameter property: The `TotalByteCount` property type.
706
- /// - Returns: The sum of all total byte counts across the entire progress subtree, in bytes.
707
- public func summary( of property: ProgressManager . Properties . TotalByteCount . Type ) -> UInt64 {
708
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
709
- return getUpdatedByteCount ( type: . total)
710
- }
711
-
712
- /// Returns the completed byte count across the progress subtree.
713
- ///
714
- /// - Parameter property: The `CompletedByteCount` property type.
715
- /// - Returns: The sum of all completed byte counts across the entire progress subtree, in bytes.
716
- public func summary( of property: ProgressManager . Properties . CompletedByteCount . Type ) -> UInt64 {
717
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
718
- return getUpdatedByteCount ( type: . completed)
719
- }
720
-
721
- /// Returns the average throughput across the progress subtree.
722
- ///
723
- /// - Parameter property: The `Throughput` property type.
724
- /// - Returns: The average throughput across the entire progress subtree, in bytes per second.
725
- ///
726
- /// - Note: The throughput is calculated as the sum of all throughput values divided by the count
727
- /// of progress managers that have throughput data.
728
- public func summary( of property: ProgressManager . Properties . Throughput . Type ) -> [ UInt64 ] {
729
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
730
- return getUpdatedThroughput ( )
731
- }
732
-
733
- /// Returns the maximum estimated time remaining for completion across the progress subtree.
734
- ///
735
- /// - Parameter property: The `EstimatedTimeRemaining` property type.
736
- /// - Returns: The estimated duration until completion for the entire progress subtree.
737
- ///
738
- /// - Note: The estimation is based on current throughput and remaining work. The accuracy
739
- /// depends on the consistency of the processing rate.
740
- public func summary( of property: ProgressManager . Properties . EstimatedTimeRemaining . Type ) -> Duration {
741
- accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
742
- return getUpdatedEstimatedTimeRemaining ( )
698
+ if property. self == ProgressManager . Properties. EstimatedTimeRemaining. self {
699
+ return getUpdatedEstimatedTimeRemaining ( )
700
+ } else {
701
+ return getUpdatedDurationSummary ( property: MetatypeWrapper ( property) )
702
+ }
743
703
}
744
704
}
0 commit comments