Search code examples
zipfoundation

ZIPFoundation in a background thread?


Are there any restrictions to using ZIPFoundation in a background thread on iOS (10.0 or later)? I am currently designing an import/export feature for my iOS app and am considering using ZIPFoundation in that feature.


Solution

  • ZIP Foundation leaves threading considerations to the API user. It does not use any queues or locks internally.

    The Archive class is not re-entrant and therefore cannot be used concurrently from different threads. It's no problem to use the framework on a background thread though. (No main thread-only requirement).

    For read operations, you can instantiate multiple Archive instances to achieve concurrent reading: https://github.com/weichsel/ZIPFoundation/issues/29#issuecomment-347139072