Closed YevhenHerasymenko closed 3 years ago
Hmm, I am not sure about this.
As far as I understand you would like to have the following function added (as an example, I use Deflate here, but this also applies to other components):
extension Deflate {
public static func decompress<Result>(data: Data, _ callback: ((???) -> Result)? = nil) throws -> Data {
/* ... */
}
}
The key question here is what should be the input type of the callback? What value should decompression function pass to the callback function to indicate the progress? Off the top of my head, I can think of two options, both vaguely defined:
Finally, I should point out that the phrase "show that everything is okay" is also hard to define, because in practice everything is okay by default, and if something is not, an error is thrown. In view of this, I personally think that the callback function is a bit redundant.
When decompress big files it takes a long time. Can you add progress callback to show that everything is okay?