Skip to content

Commit 99cca8e

Browse files
committed
temporarily change availability back to 6.2 + add typealias for ProgressReporter
1 parent 518b3b3 commit 99cca8e

9 files changed

+44
-41
lines changed

Sources/FoundationEssentials/ProgressManager/ProgressManager+Interop.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal import _ForSwiftFoundation
1515
internal import Synchronization
1616

1717
//MARK: Progress Parent - Subprogress / ProgressReporter Child Interop
18-
@available(FoundationPreview 6.3, *)
18+
@available(FoundationPreview 6.2, *)
1919
extension Progress {
2020

2121
/// Returns a Subprogress which can be passed to any method that reports progress
@@ -91,7 +91,7 @@ extension Progress {
9191
}
9292
}
9393

94-
@available(FoundationPreview 6.3, *)
94+
@available(FoundationPreview 6.2, *)
9595
//MARK: ProgressManager Parent - Progress Child Interop
9696
extension ProgressManager {
9797

@@ -117,7 +117,7 @@ extension ProgressManager {
117117
}
118118
}
119119

120-
@available(FoundationPreview 6.3, *)
120+
@available(FoundationPreview 6.2, *)
121121
internal final class SubprogressBridge: Sendable {
122122

123123
internal let progressBridge: Progress
@@ -142,7 +142,7 @@ internal final class SubprogressBridge: Sendable {
142142
}
143143
}
144144

145-
@available(FoundationPreview 6.3, *)
145+
@available(FoundationPreview 6.2, *)
146146
internal final class ProgressReporterBridge: Sendable {
147147

148148
internal let progressBridge: Progress
@@ -174,7 +174,7 @@ internal final class ProgressReporterBridge: Sendable {
174174

175175
}
176176

177-
@available(FoundationPreview 6.3, *)
177+
@available(FoundationPreview 6.2, *)
178178
internal final class NSProgressBridge: Progress, @unchecked Sendable {
179179

180180
internal let manager: ProgressManager
@@ -211,7 +211,7 @@ internal final class NSProgressBridge: Progress, @unchecked Sendable {
211211
}
212212
}
213213

214-
@available(FoundationPreview 6.3, *)
214+
@available(FoundationPreview 6.2, *)
215215
extension ProgressManager {
216216
// Keeping this as an enum in case we have other states to track in the future.
217217
internal enum ObserverState {
@@ -275,7 +275,7 @@ extension ProgressManager {
275275
}
276276
}
277277

278-
@available(FoundationPreview 6.3, *)
278+
@available(FoundationPreview 6.2, *)
279279
extension ProgressManager.State {
280280
internal func notifyObservers(with observerState: ProgressManager.ObserverState) {
281281
for observer in observers {
@@ -284,7 +284,7 @@ extension ProgressManager.State {
284284
}
285285
}
286286

287-
@available(FoundationPreview 6.3, *)
287+
@available(FoundationPreview 6.2, *)
288288
extension ProgressManager {
289289
//MARK: Interop Methods
290290
/// Adds `observer` to list of `_observers` in `self`.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
internal import Synchronization
1414

15-
@available(FoundationPreview 6.3, *)
15+
@available(FoundationPreview 6.2, *)
1616
extension ProgressManager {
1717

1818
// MARK: Methods to Read & Write Additional Properties of single ProgressManager node

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

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

13-
@available(FoundationPreview 6.3, *)
13+
@available(FoundationPreview 6.2, *)
1414
extension ProgressManager {
1515

1616
/// A type that conveys additional task-specific information on progress.
@@ -100,11 +100,11 @@ extension ProgressManager {
100100
}
101101

102102
// Namespace for properties specific to operations reported on
103-
public struct Properties: Sendable {
103+
public enum Properties: Sendable {
104104

105105
/// The total number of files.
106106
public var totalFileCount: TotalFileCount.Type { TotalFileCount.self }
107-
public struct TotalFileCount: Sendable, Property {
107+
public enum TotalFileCount: Sendable, Property {
108108

109109
public typealias Value = Int
110110

@@ -131,7 +131,7 @@ extension ProgressManager {
131131

132132
/// The number of completed files.
133133
public var completedFileCount: CompletedFileCount.Type { CompletedFileCount.self }
134-
public struct CompletedFileCount: Sendable, Property {
134+
public enum CompletedFileCount: Sendable, Property {
135135

136136
public typealias Value = Int
137137

@@ -158,7 +158,7 @@ extension ProgressManager {
158158

159159
/// The total number of bytes.
160160
public var totalByteCount: TotalByteCount.Type { TotalByteCount.self }
161-
public struct TotalByteCount: Sendable, Property {
161+
public enum TotalByteCount: Sendable, Property {
162162

163163
public typealias Value = UInt64
164164

@@ -185,7 +185,7 @@ extension ProgressManager {
185185

186186
/// The number of completed bytes.
187187
public var completedByteCount: CompletedByteCount.Type { CompletedByteCount.self }
188-
public struct CompletedByteCount: Sendable, Property {
188+
public enum CompletedByteCount: Sendable, Property {
189189

190190
public typealias Value = UInt64
191191

@@ -212,7 +212,7 @@ extension ProgressManager {
212212

213213
/// The throughput, in bytes per second.
214214
public var throughput: Throughput.Type { Throughput.self }
215-
public struct Throughput: Sendable, Property {
215+
public enum Throughput: Sendable, Property {
216216
public typealias Value = UInt64
217217

218218
public typealias Summary = [UInt64]
@@ -238,7 +238,7 @@ extension ProgressManager {
238238

239239
/// The amount of time remaining in the processing of files.
240240
public var estimatedTimeRemaining: EstimatedTimeRemaining.Type { EstimatedTimeRemaining.self }
241-
public struct EstimatedTimeRemaining: Sendable, Property {
241+
public enum EstimatedTimeRemaining: Sendable, Property {
242242

243243
public typealias Value = Duration
244244

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
internal import Synchronization
14-
@available(FoundationPreview 6.3, *)
14+
@available(FoundationPreview 6.2, *)
1515
extension ProgressManager {
1616

1717
internal enum CountType {

Sources/FoundationEssentials/ProgressManager/ProgressManager+State.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212
internal import Synchronization
1313

14-
@available(FoundationPreview 6.3, *)
14+
@available(FoundationPreview 6.2, *)
1515
extension ProgressManager {
1616

1717
internal struct MetatypeWrapper<V: Sendable, S: Sendable>: Hashable, Equatable, Sendable {

Sources/FoundationEssentials/ProgressManager/ProgressManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal import _FoundationCollections
2222
#endif
2323

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

2828
internal let state: Mutex<State>
@@ -395,7 +395,7 @@ internal import _FoundationCollections
395395
}
396396
}
397397

398-
@available(FoundationPreview 6.3, *)
398+
@available(FoundationPreview 6.2, *)
399399
extension ProgressManager: Hashable, Equatable {
400400
public func hash(into hasher: inout Hasher) {
401401
hasher.combine(ObjectIdentifier(self))
@@ -407,7 +407,7 @@ extension ProgressManager: Hashable, Equatable {
407407
}
408408
}
409409

410-
@available(FoundationPreview 6.3, *)
410+
@available(FoundationPreview 6.2, *)
411411
extension ProgressManager: CustomStringConvertible, CustomDebugStringConvertible {
412412
/// A description.
413413
public var description: String {

Sources/FoundationEssentials/ProgressManager/ProgressReporter.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ import Observation
1515
/// ProgressReporter is a wrapper for ProgressManager that carries information about ProgressManager.
1616
///
1717
/// It is read-only and can be added as a child of another ProgressManager.
18-
@available(FoundationPreview 6.3, *)
18+
@available(FoundationPreview 6.2, *)
1919
@Observable public final class ProgressReporter: Sendable, Hashable, Equatable, CustomStringConvertible, CustomDebugStringConvertible {
2020

21+
public typealias Values = ProgressManager.Values
22+
public typealias Property = ProgressManager.Property
23+
2124
/// The total units of work.
2225
public var totalCount: Int? {
2326
manager.totalCount
@@ -81,7 +84,7 @@ import Observation
8184

8285
/// Reads properties that convey additional information about progress.
8386
public func withProperties<T, E: Error>(
84-
_ closure: (sending ProgressManager.Values) throws(E) -> sending T
87+
_ closure: (sending Values) throws(E) -> sending T
8588
) throws(E) -> T {
8689
return try manager.getProperties(closure)
8790
}
@@ -94,7 +97,7 @@ import Observation
9497
/// - Parameter property: The type of the integer property to summarize. Must be a property
9598
/// where both the value and summary types are `Int`.
9699
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
97-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> Int where P.Value == Int, P.Summary == Int {
100+
public func summary<P: Property>(of property: P.Type) -> Int where P.Value == Int, P.Summary == Int {
98101
manager.summary(of: property)
99102
}
100103

@@ -106,7 +109,7 @@ import Observation
106109
/// - Parameter property: The type of the unsigned property to summarize. Must be a property
107110
/// where both the value and summary types are `UInt64`.
108111
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
109-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> UInt64 where P.Value == UInt64, P.Summary == UInt64 {
112+
public func summary<P: Property>(of property: P.Type) -> UInt64 where P.Value == UInt64, P.Summary == UInt64 {
110113
manager.summary(of: property)
111114
}
112115

@@ -118,7 +121,7 @@ import Observation
118121
/// - Parameter property: The type of the double property to summarize. Must be a property
119122
/// where both the value and summary types are `Double`.
120123
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
121-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> Double where P.Value == Double, P.Summary == Double {
124+
public func summary<P: Property>(of property: P.Type) -> Double where P.Value == Double, P.Summary == Double {
122125
manager.summary(of: property)
123126
}
124127

@@ -130,7 +133,7 @@ import Observation
130133
/// - Parameter property: The type of the string property to summarize. Must be a property
131134
/// where both the value and summary types are `String`.
132135
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
133-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> [String?] where P.Value == String?, P.Summary == [String?] {
136+
public func summary<P: Property>(of property: P.Type) -> [String?] where P.Value == String?, P.Summary == [String?] {
134137
return manager.summary(of: property)
135138
}
136139

@@ -142,7 +145,7 @@ import Observation
142145
/// - Parameter property: The type of the URL property to summarize. Must be a property
143146
/// where both the value and summary types are `URL?` and `[URL?]` respectively.
144147
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
145-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> [URL?] where P.Value == URL?, P.Summary == [URL?] {
148+
public func summary<P: Property>(of property: P.Type) -> [URL?] where P.Value == URL?, P.Summary == [URL?] {
146149
return manager.summary(of: property)
147150
}
148151

@@ -154,7 +157,7 @@ import Observation
154157
/// - Parameter property: The type of the unsigned integer property to summarize. Must be a property
155158
/// where the value type is `UInt64` and the summary type is `[UInt64]`.
156159
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
157-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> [UInt64] where P.Value == UInt64, P.Summary == [UInt64] {
160+
public func summary<P: Property>(of property: P.Type) -> [UInt64] where P.Value == UInt64, P.Summary == [UInt64] {
158161
return manager.summary(of: property)
159162
}
160163

@@ -166,7 +169,7 @@ import Observation
166169
/// - Parameter property: The type of the duration property to summarize. Must be a property
167170
/// where both the value and summary types are `Duration`.
168171
/// - Returns: The aggregated summary value for the specified property across the entire subtree.
169-
public func summary<P: ProgressManager.Property>(of property: P.Type) -> Duration where P.Value == Duration, P.Summary == Duration {
172+
public func summary<P: Property>(of property: P.Type) -> Duration where P.Value == Duration, P.Summary == Duration {
170173
return manager.summary(of: property)
171174
}
172175

Sources/FoundationEssentials/ProgressManager/Subprogress.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
///
1515
/// Subprogress is returned from a call to `subprogress(assigningCount:)` by a parent ProgressManager.
1616
/// A child ProgressManager is then returned by calling `start(totalCount:)` on a Subprogress.
17-
@available(FoundationPreview 6.3, *)
17+
@available(FoundationPreview 6.2, *)
1818
public struct Subprogress: ~Copyable, Sendable {
1919
internal var parent: ProgressManager
2020
internal var portionOfParent: Int

Tests/FoundationEssentialsTests/ProgressManager/ProgressManagerPropertiesTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ import Testing
384384
extension ProgressManager.Properties {
385385

386386
var counter: Counter.Type { Counter.self }
387-
struct Counter: Sendable, ProgressManager.Property {
387+
struct Counter: Sendable, Property {
388388

389389
typealias Value = Int
390390

@@ -488,7 +488,7 @@ extension ProgressManager.Properties {
488488

489489
extension ProgressManager.Properties {
490490
var byteSize: ByteSize.Type { ByteSize.self }
491-
struct ByteSize: Sendable, ProgressManager.Property {
491+
struct ByteSize: Sendable, Property {
492492

493493
typealias Value = UInt64
494494

@@ -594,7 +594,7 @@ func doSomethingTwoLevels(subprogress: consuming Subprogress) async {
594594
extension ProgressManager.Properties {
595595

596596
var justADouble: JustADouble.Type { JustADouble.self }
597-
struct JustADouble: Sendable, ProgressManager.Property {
597+
struct JustADouble: Sendable, Property {
598598

599599
typealias Value = Double
600600

@@ -697,7 +697,7 @@ extension ProgressManager.Properties {
697697
extension ProgressManager.Properties {
698698

699699
var downloadedFile: DownloadedFile.Type { DownloadedFile.self }
700-
struct DownloadedFile: Sendable, ProgressManager.Property {
700+
struct DownloadedFile: Sendable, Property {
701701

702702
typealias Value = String?
703703

@@ -797,7 +797,7 @@ extension ProgressManager.Properties {
797797
extension ProgressManager.Properties {
798798

799799
var processingFile: ProcessingFile.Type { ProcessingFile.self }
800-
struct ProcessingFile: Sendable, ProgressManager.Property {
800+
struct ProcessingFile: Sendable, Property {
801801

802802
typealias Value = String?
803803

@@ -896,7 +896,7 @@ extension ProgressManager.Properties {
896896

897897
extension ProgressManager.Properties {
898898
var imageURL: ImageURL.Type { ImageURL.self }
899-
struct ImageURL: Sendable, ProgressManager.Property {
899+
struct ImageURL: Sendable, Property {
900900

901901
typealias Value = URL?
902902

@@ -989,7 +989,7 @@ extension ProgressManager.Properties {
989989

990990
extension ProgressManager.Properties {
991991
var totalPixelCount: TotalPixelCount.Type { TotalPixelCount.self }
992-
struct TotalPixelCount: Sendable, ProgressManager.Property {
992+
struct TotalPixelCount: Sendable, Property {
993993
typealias Value = UInt64
994994

995995
typealias Summary = [UInt64]
@@ -1082,7 +1082,7 @@ extension ProgressManager.Properties {
10821082

10831083
extension ProgressManager.Properties {
10841084
var viralIndeterminate: ViralIndeterminate.Type { ViralIndeterminate.self }
1085-
struct ViralIndeterminate: Sendable, ProgressManager.Property {
1085+
struct ViralIndeterminate: Sendable, Property {
10861086
typealias Value = Int
10871087

10881088
typealias Summary = Int
@@ -1183,7 +1183,7 @@ extension ProgressManager.Properties {
11831183

11841184
extension ProgressManager.Properties {
11851185
var processTime: ProcessTime.Type { ProcessTime.self }
1186-
struct ProcessTime: Sendable, ProgressManager.Property {
1186+
struct ProcessTime: Sendable, Property {
11871187

11881188
typealias Value = Duration
11891189

0 commit comments

Comments
 (0)