Go to file
1024jp a8033c7f9d Remove lines for CocoaPods in .gitignore 2019-10-23 13:38:12 +09:00
Documentation Update documentations 2016-11-30 04:03:31 +09:00
Gzip.xcodeproj Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
Project Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
Sources Fix DataSize.chunk (fix #41) 2019-10-23 13:38:12 +09:00
Tests Perform random tests multiple times 2019-04-02 17:53:38 +09:00
.gitignore Remove lines for CocoaPods in .gitignore 2019-10-23 13:38:12 +09:00
.swift-version Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
.swiftlint.yml Add more opt-in swiftlint rules 2017-08-06 12:42:31 +09:00
.travis.yml Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
CHANGELOG.md Fix DataSize.chunk (fix #41) 2019-10-23 13:38:12 +09:00
GzipSwift.podspec fix OC pod error 2019-08-13 15:53:03 +08:00
LICENSE Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
Package.swift Update Swift to Swift 5 2019-04-02 13:08:36 +09:00
README.md Update Swift to Swift 5 2019-04-02 13:08:36 +09:00

README.md

GzipSwift

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

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 5.0.0

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

Manual Build

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

License

© 2014-2019 1024jp

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