I\'d like to be able to inflate/deflate Swift3 Data structs. I found GzipSwift, but it\'s not clear how I make that available to my iOS app. The naive things I\'ve tried inc
I maintain a small Swift 3+ wrapper around Apples native libcompression framework at:
https://github.com/mw99/DataCompression
Usage example for gzip:
let data: Data! = "https://www.ietf.org/rfc/rfc1952.txt".data(using: .utf8)
let gzipped: Data! = data.zip()
let gunzipped: Data? = gzipped.unzip()
assert(data == gunzipped)
But if you are only interested in classic inflate and deflate you may use the .inflate()
and .deflate()
methods instead. That will save 18 bytes because the gzip header won't be added.