Skip to content

Commit 7fa9b38

Browse files
authored
Merge pull request #4 from orchetect/dev-progress-labels
`LabelProgress` deinit now triggers parent progress to update itself
2 parents f028eca + 333ff3d commit 7fa9b38

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Sources/OTOperations/Progress/LabelProgress.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,20 @@ public class LabelProgress: Progress {
202202

203203
}
204204

205+
deinit {
206+
207+
// manually nil the label
208+
setUserInfoObject(nil, forKey: .label)
209+
210+
// notify the parent to update
211+
if let parentProgress = labelProgressParent {
212+
DispatchQueue.global().async {
213+
parentProgress.updateUserInfoWithChildLabelsAndNotifyParent()
214+
}
215+
}
216+
217+
}
218+
205219
}
206220

207221
#endif

0 commit comments

Comments
 (0)