Skip to content

Commit c21edd7

Browse files
committed
rename interop methods based on api-central review
1 parent d7a1c82 commit c21edd7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Sources/FoundationEssentials/ProgressManager/ProgressManager+Interop.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension Progress {
2828
/// - Parameter count: Number of units delegated to a child instance of `ProgressManager`
2929
/// which may be instantiated by `Subprogress` later when `reporter(totalCount:)` is called.
3030
/// - Returns: A `Subprogress` instance.
31-
public func makeChild(withPendingUnitCount count: Int) -> Subprogress {
31+
public func subprogress(assigningCount count: Int) -> Subprogress {
3232

3333
// Make a ProgressManager
3434
let manager = ProgressManager(totalCount: 1)
@@ -102,7 +102,7 @@ extension ProgressManager {
102102
/// - Parameters:
103103
/// - count: Number of units delegated from `self`'s `totalCount`.
104104
/// - progress: `Progress` which receives the delegated `count`.
105-
public func subprogress(assigningCount count: Int, to progress: Foundation.Progress) {
105+
public func assign(count: Int, to progress: Foundation.Progress) {
106106
precondition(progress._parent() == nil, "Cannot assign a progress to more than one parent.")
107107

108108
// Create a ProgressManager - NSProgress bridge

Tests/FoundationEssentialsTests/ProgressManager/ProgressManagerInteropTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Testing
4747
#expect(overall.completedUnitCount == 5)
4848

4949
// Add ProgressManager as Child
50-
let p2 = overall.makeChild(withPendingUnitCount: 5)
50+
let p2 = overall.subprogress(assigningCount: 5)
5151
await doSomething(subprogress: p2)
5252

5353
// Check if ProgressManager values propagate to Progress parent
@@ -73,7 +73,7 @@ import Testing
7373

7474
let p2 = Progress(totalUnitCount: 1, parent: overall, pendingUnitCount: 5)
7575

76-
await doSomething(subprogress: p2.makeChild(withPendingUnitCount: 1))
76+
await doSomething(subprogress: p2.subprogress(assigningCount: 1))
7777

7878
// Check if ProgressManager values propagate to Progress parent
7979
#expect(overall.fractionCompleted == 1.0)
@@ -108,7 +108,7 @@ import Testing
108108
p3.completedUnitCount = 2
109109
}.value
110110

111-
await doSomething(subprogress: p2.makeChild(withPendingUnitCount: 9))
111+
await doSomething(subprogress: p2.subprogress(assigningCount: 9))
112112

113113
// Check if ProgressManager values propagate to Progress parent
114114
#expect(overall.fractionCompleted == 1.0)
@@ -229,7 +229,7 @@ import Testing
229229

230230
// Interop: Add Progress as Child
231231
let p2 = await doSomethingWithProgress()
232-
overallManager.subprogress(assigningCount: 5, to: p2)
232+
overallManager.assign(count: 5, to: p2)
233233

234234
let _ = await Task.detached {
235235
p2.completedUnitCount = 1
@@ -258,7 +258,7 @@ import Testing
258258

259259

260260
let p3 = await doSomethingWithProgress()
261-
p2.subprogress(assigningCount: 2, to: p3)
261+
p2.assign(count: 2, to: p3)
262262

263263
let _ = await Task.detached {
264264
p3.completedUnitCount = 1
@@ -288,7 +288,7 @@ import Testing
288288

289289
let overallReporter2 = ProgressManager(totalCount: nil)
290290
let interopChild = getProgressWithTotalCountInitialized()
291-
overallReporter2.subprogress(assigningCount: 5, to: interopChild)
291+
overallReporter2.assign(count: 5, to: interopChild)
292292
#expect(overallReporter2.totalCount == nil)
293293
}
294294

@@ -299,7 +299,7 @@ import Testing
299299
#expect(overallProgress.totalUnitCount == 0)
300300

301301
let overallProgress2 = Progress()
302-
let interopChild = overallProgress2.makeChild(withPendingUnitCount: 5)
302+
let interopChild = overallProgress2.subprogress(assigningCount: 5)
303303
receiveProgress(progress: interopChild)
304304
#expect(overallProgress2.totalUnitCount == 0)
305305
}
@@ -316,7 +316,7 @@ import Testing
316316
parentManager2.assign(count: 1, to: manager.reporter)
317317

318318
let progress = Progress.discreteProgress(totalUnitCount: 4)
319-
manager.subprogress(assigningCount: 1, to: progress)
319+
manager.assign(count: 1, to: progress)
320320

321321
progress.completedUnitCount = 2
322322
#expect(progress.fractionCompleted == 0.5)

0 commit comments

Comments
 (0)