Swiftpack.co -  1024jp/GzipSwift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift framework that enables gzip/gunzip Data using zlib
.package(url: "https://github.com/1024jp/GzipSwift.git", from: "5.1.1")


platform CI Status Carthage-compatible SwiftPM-compatible CocoaPods-compatible

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, 5.1


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


Swift Package Manager

GzipSwift is SwiftPM-compatible. To install, add this package to your Package.swift or your Xcode project.

For Linux

  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


GzipSwift is Carthage-compatible. To install, add the following line to your Cartfile:

github "1024jp/GzipSwift"


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

pod 'GzipSwift'

Manual 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 <img style="max-width:100%;" src="https://raw.github.com/1024jp/GzipSwift/develop/mbedded Binaries__ section.


© 2014-2020 1024jp

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


Stars: 366
Last commit: 1 year ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API