[swift-evolution] Pitch: Progress Tracking in Swift

Will Entriken fulldecent at gmail.com
Mon Jan 18 11:26:09 CST 2016


Charles,

I think this is interesting. And discussion on replacing/updating
NSProgress is important.

Just a note: optional parameters make this possible without changing the
language. A very rough example follows:

func delete(files: FileList, withProgress progress: Progress? = nil) {
    progress.totalUnits = 10
    print("Getting started")
    progress.completedUnits = 5 // that was easy!
    actuallyDelete(files, withProgress: progress.childWithUnits: 5)
}

let progress = Progress()
// watch progress.totalPortion using KVO 2.0
delete(files: allTheFiles, withProgress: progress)

Regards,
Will





On Sun, Jan 17, 2016 at 9:42 PM, Charles Srstka via swift-evolution <
swift-evolution at swift.org> wrote:

> Typo here: This should have said "on the current thread." The fact that
> NSProgress bogs down the worker thread with the work involved in creating
> the KVO notifications is part of my issue with it.
>
> Charles
>
> On 2016-01-17 21:14, Charles Srstka via swift-evolution wrote:
>
> 5. NSProgress posts KVO notifications on the main thread.
>>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160118/4ede3da6/attachment.html>


More information about the swift-evolution mailing list