91cb18dd8f | ||
---|---|---|
Documentation | ||
Project | ||
Sources | ||
zlib | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG.md | ||
LICENSE | ||
README.md |
README.md
NSData+GZIP.swift
NSData+GZIP.swift is an extension of Data written in Swift 3.0. It enables compress/decompress gzip using zlib.
- Requirements: OS X 10.9 / iOS 7 or later
Usage
// gzip
let compressedData: Data = try! data.gzipped()
let optimizedData: Data = try! data.gzipped(level: .bestCompression)
// gunzip
let decompressedData: Data
if data.isGzipped {
decompressedData = try! data.gunzipped()
} else {
decompressedData = data
}
Installation
- 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.
Lisence
© 2014-2016 1024jp
NSData+GZIP.swift is distributed under the terms of the MIT License. See LISENCE for details.