Go to file
1024jp a4c2391179 Update cocoapods badge in README 2017-02-14 02:18:54 +09:00
Documentation Update documentations 2016-11-30 04:03:31 +09:00
Gzip.xcodeproj Fix paths to libz.tbd 2017-02-14 02:06:25 +09:00
Project Update version number to 3.1.4 2017-02-14 02:08:54 +09:00
Sources Update version number to 3.1.2 2016-11-26 00:18:24 +09:00
Tests Add test for SPM 2016-11-10 19:03:38 +09:00
zlib Use modulemap instead of bridging header 2015-08-31 18:12:48 +09:00
.gitignore Add test for SPM 2016-11-10 19:03:38 +09:00
.swift-version Add podspec (#4) 2016-11-26 00:09:59 +09:00
.travis.yml Update Xcode to 8.2 2016-12-14 14:41:54 +09:00
CHANGELOG.md Fix paths to libz.tbd 2017-02-14 02:06:25 +09:00
GzipSwift.podspec Update version number to 3.1.4 2017-02-14 02:08:54 +09:00
LICENSE Update copyright year 2017-02-14 02:06:27 +09:00
Package.swift Rename SPM's package name to Gzip 2016-11-10 18:39:46 +09:00
README.md Update cocoapods badge in README 2017-02-14 02:18:54 +09:00

README.md

GzipSwift

Swift platform Carthage compatible SPM compatible CocoaPods compatible Build Status codecov.io License

GzipSwift is a framework with an extension of Data written in Swift. It enables compress/decompress gzip using zlib.

  • Requirements: OS X 10.9 / iOS 8 / watchOS 2 / tvOS 9 or later
  • Swift version: Swift 3.0.1

Usage

import Gzip

// 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

  1. Open Gzip.xcodeproj on Xcode and build Gzip framework for your target platform.
  2. Append the built Gzip.framework to your project.
  3. Go to General pane of the application target in your project. Add Gzip.framework to the Embedded Binaries section.
  4. import Gzip in your Swift file and use in your code.

Carthage

GzipSwift is Carthage compatible. You can easily build GzipSwift adding the following line to your Cartfile:

github "1024jp/GzipSwift"

CocoaPods

GzipSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'GzipSwift'

Swift Package Manager

  1. First you need to install zlib if you haven't installed yet:

    $ apt-get install zlib-dev
    
  2. Add this package to your package.swift.

  3. If Swift build failed with a linker error:

    • check if libz.so is in your /usr/local/lib
    • if no, reinstall zlib as step (1)
    • if yes, link the library manually by passing '-Xlinker -L/usr/local/lib' with swift build

Lisence

© 2014-2017 1024jp

GzipSwift is distributed under the terms of the MIT License. See LISENCE for details.