@@ -28,10 +28,11 @@ extension ProgressManager {
28
28
let throughputDirty : Bool
29
29
let estimatedTimeRemainingDirty : Bool
30
30
let dirtyPropertiesInt : [ MetatypeWrapper < Int , Int > ]
31
+ let dirtyPropertiesUInt64 : [ MetatypeWrapper < UInt64 , UInt64 > ]
31
32
let dirtyPropertiesDouble : [ MetatypeWrapper < Double , Double > ]
32
33
let dirtyPropertiesString : [ MetatypeWrapper < String ? , [ String ? ] > ]
33
34
let dirtyPropertiesURL : [ MetatypeWrapper < URL ? , [ URL ? ] > ]
34
- let dirtyPropertiesUInt64 : [ MetatypeWrapper < UInt64 , [ UInt64 ] > ]
35
+ let dirtyPropertiesUInt64Array : [ MetatypeWrapper < UInt64 , [ UInt64 ] > ]
35
36
#if FOUNDATION_FRAMEWORK
36
37
let observerState : ObserverState ?
37
38
let interopType : InteropType ?
@@ -61,10 +62,11 @@ extension ProgressManager {
61
62
throughput: ProgressManager . Properties. Throughput. defaultValue,
62
63
estimatedTimeRemaining: ProgressManager . Properties. EstimatedTimeRemaining. defaultValue,
63
64
propertiesInt: [ : ] ,
65
+ propertiesUInt64: [ : ] ,
64
66
propertiesDouble: [ : ] ,
65
67
propertiesString: [ : ] ,
66
68
propertiesURL: [ : ] ,
67
- propertiesUInt64 : [ : ] ,
69
+ propertiesUInt64Array : [ : ] ,
68
70
observers: [ ] ,
69
71
interopType: nil ,
70
72
)
@@ -80,10 +82,11 @@ extension ProgressManager {
80
82
throughput: ProgressManager . Properties. Throughput. defaultValue,
81
83
estimatedTimeRemaining: ProgressManager . Properties. EstimatedTimeRemaining. defaultValue,
82
84
propertiesInt: [ : ] ,
85
+ propertiesUInt64: [ : ] ,
83
86
propertiesDouble: [ : ] ,
84
87
propertiesString: [ : ] ,
85
88
propertiesURL: [ : ] ,
86
- propertiesUInt64 : [ : ]
89
+ propertiesUInt64Array : [ : ]
87
90
)
88
91
#endif
89
92
let result = try closure ( & values)
@@ -100,10 +103,11 @@ extension ProgressManager {
100
103
throughputDirty: values. throughputDirty,
101
104
estimatedTimeRemainingDirty: values. estimatedTimeRemainingDirty,
102
105
dirtyPropertiesInt: values. dirtyPropertiesInt,
106
+ dirtyPropertiesUInt64: values. dirtyPropertiesUInt64,
103
107
dirtyPropertiesDouble: values. dirtyPropertiesDouble,
104
108
dirtyPropertiesString: values. dirtyPropertiesString,
105
109
dirtyPropertiesURL: values. dirtyPropertiesURL,
106
- dirtyPropertiesUInt64 : values. dirtyPropertiesUInt64 ,
110
+ dirtyPropertiesUInt64Array : values. dirtyPropertiesUInt64Array ,
107
111
observerState: values. observerState,
108
112
interopType: state. interopType
109
113
)
@@ -118,10 +122,11 @@ extension ProgressManager {
118
122
throughputDirty: values. throughputDirty,
119
123
estimatedTimeRemainingDirty: values. estimatedTimeRemainingDirty,
120
124
dirtyPropertiesInt: values. dirtyPropertiesInt,
125
+ dirtyPropertiesUInt64: values. dirtyPropertiesUInt64,
121
126
dirtyPropertiesDouble: values. dirtyPropertiesDouble,
122
127
dirtyPropertiesString: values. dirtyPropertiesString,
123
128
dirtyPropertiesURL: values. dirtyPropertiesURL,
124
- dirtyPropertiesUInt64 : values. dirtyPropertiesUInt64
129
+ dirtyPropertiesUInt64Array : values. dirtyPropertiesUInt64Array
125
130
)
126
131
#endif
127
132
@@ -180,6 +185,12 @@ extension ProgressManager {
180
185
}
181
186
}
182
187
188
+ if dirtyInfo. dirtyPropertiesUInt64. count > 0 {
189
+ for property in dirtyInfo. dirtyPropertiesInt {
190
+ markSelfDirty ( property: property, parents: dirtyInfo. parents)
191
+ }
192
+ }
193
+
183
194
if dirtyInfo. dirtyPropertiesDouble. count > 0 {
184
195
for property in dirtyInfo. dirtyPropertiesDouble {
185
196
markSelfDirty ( property: property, parents: dirtyInfo. parents)
@@ -198,8 +209,8 @@ extension ProgressManager {
198
209
}
199
210
}
200
211
201
- if dirtyInfo. dirtyPropertiesUInt64 . count > 0 {
202
- for property in dirtyInfo. dirtyPropertiesUInt64 {
212
+ if dirtyInfo. dirtyPropertiesUInt64Array . count > 0 {
213
+ for property in dirtyInfo. dirtyPropertiesUInt64Array {
203
214
markSelfDirty ( property: property, parents: dirtyInfo. parents)
204
215
}
205
216
}
@@ -219,10 +230,11 @@ extension ProgressManager {
219
230
internal var throughputDirty = false
220
231
internal var estimatedTimeRemainingDirty = false
221
232
internal var dirtyPropertiesInt : [ MetatypeWrapper < Int , Int > ] = [ ]
233
+ internal var dirtyPropertiesUInt64 : [ MetatypeWrapper < UInt64 , UInt64 > ] = [ ]
222
234
internal var dirtyPropertiesDouble : [ MetatypeWrapper < Double , Double > ] = [ ]
223
235
internal var dirtyPropertiesString : [ MetatypeWrapper < String ? , [ String ? ] > ] = [ ]
224
236
internal var dirtyPropertiesURL : [ MetatypeWrapper < URL ? , [ URL ? ] > ] = [ ]
225
- internal var dirtyPropertiesUInt64 : [ MetatypeWrapper < UInt64 , [ UInt64 ] > ] = [ ]
237
+ internal var dirtyPropertiesUInt64Array : [ MetatypeWrapper < UInt64 , [ UInt64 ] > ] = [ ]
226
238
#if FOUNDATION_FRAMEWORK
227
239
internal var observerState : ObserverState ?
228
240
#endif
@@ -401,6 +413,29 @@ extension ProgressManager {
401
413
}
402
414
}
403
415
416
+ /// Gets or sets custom integer properties.
417
+ ///
418
+ /// This subscript provides read-write access to custom progress properties where both the value
419
+ /// and summary types are `UInt64`. If the property has not been set, the getter returns the
420
+ /// property's default value.
421
+ ///
422
+ /// - Parameter key: A key path to the custom integer property type.
423
+ public subscript< P: Property > ( dynamicMember key: KeyPath < ProgressManager . Properties , P . Type > ) -> UInt64 where P. Value == UInt64 , P. Summary == UInt64 {
424
+ get {
425
+ return state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] ?? P . defaultValue
426
+ }
427
+
428
+ set {
429
+ guard newValue != state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] else {
430
+ return
431
+ }
432
+
433
+ state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] = newValue
434
+
435
+ dirtyPropertiesUInt64. append ( MetatypeWrapper ( P . self) )
436
+ }
437
+ }
438
+
404
439
/// Gets or sets custom double properties.
405
440
///
406
441
/// This subscript provides read-write access to custom progress properties where both the value
@@ -479,17 +514,17 @@ extension ProgressManager {
479
514
/// - Parameter key: A key path to the custom UInt64 property type.
480
515
public subscript< P: Property > ( dynamicMember key: KeyPath < ProgressManager . Properties , P . Type > ) -> UInt64 ? where P. Value == UInt64 , P. Summary == [ UInt64 ] {
481
516
get {
482
- return state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] ?? P . self. defaultValue
517
+ return state. propertiesUInt64Array [ MetatypeWrapper ( P . self) ] ?? P . self. defaultValue
483
518
}
484
519
485
520
set {
486
- guard newValue != state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] else {
521
+ guard newValue != state. propertiesUInt64Array [ MetatypeWrapper ( P . self) ] else {
487
522
return
488
523
}
489
524
490
- state. propertiesUInt64 [ MetatypeWrapper ( P . self) ] = newValue
525
+ state. propertiesUInt64Array [ MetatypeWrapper ( P . self) ] = newValue
491
526
492
- dirtyPropertiesUInt64 . append ( MetatypeWrapper ( P . self) )
527
+ dirtyPropertiesUInt64Array . append ( MetatypeWrapper ( P . self) )
493
528
}
494
529
}
495
530
@@ -529,11 +564,23 @@ extension ProgressManager {
529
564
/// where both the value and summary types are `Int`.
530
565
/// - Returns: An `Int` summary value for the specified property.
531
566
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == Int , P. Summary == Int {
532
- // self[fakeKeypath: MetatypeWrapper(P.self)]
533
567
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
534
568
return getUpdatedIntSummary ( property: MetatypeWrapper ( property) )
535
569
}
536
570
571
+ /// Returns a summary for a custom unsigned integer property across the progress subtree.
572
+ ///
573
+ /// This method aggregates the values of a custom integer property from this progress manager
574
+ /// and all its children, returning a consolidated summary value.
575
+ ///
576
+ /// - Parameter property: The type of the integer property to summarize. Must be a property
577
+ /// where both the value and summary types are `UInt64`.
578
+ /// - Returns: An `UInt64` summary value for the specified property.
579
+ public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == UInt64 , P. Summary == UInt64 {
580
+ accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
581
+ return getUpdatedUInt64Summary ( property: MetatypeWrapper ( property) )
582
+ }
583
+
537
584
/// Returns a summary for a custom double property across the progress subtree.
538
585
///
539
586
/// This method aggregates the values of a custom double property from this progress manager
@@ -583,7 +630,7 @@ extension ProgressManager {
583
630
/// - Returns: A `[UInt64]` summary value for the specified property.
584
631
public func summary< P: Property > ( of property: P . Type ) -> P . Summary where P. Value == UInt64 , P. Summary == [ UInt64 ] {
585
632
accessObservation ( keyPath: ProgressManager . additionalPropertiesKeyPath. withLock { $0 } )
586
- return getUpdatedUInt64Summary ( property: MetatypeWrapper ( property) )
633
+ return getUpdatedUInt64ArraySummary ( property: MetatypeWrapper ( property) )
587
634
}
588
635
589
636
/// Returns the total file count across the progress subtree.
0 commit comments