NSData+GZIP.swift is an extension of NSData written in Swift 2.0. It enables compress/decompress gzip using zlib.
- Requirements: OS X 10.9 / iOS 7 or later
// gzip
let compressedData : NSData = try! data.gzippedData()
// gunzip
let decompressedData : NSData = try! compressedData.gunzippedData()
- Add
NSData+GZIP.swift
file to your project. - Add
zlib/
directory to your project. - In Build Phases, add
libz.tbd
library to your project. - In Build Settings > Swift Compiler - Search Paths, Add path to
zlib/
to Import Paths (SWIFT_INCLUDE_PATHS
). - Invoke from your Swift/ObjC files.
© 2014-2015 1024jp
NSData+GZIP.swift is distributed under the terms of the MIT License. See LISENCE for details.