GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sourcewerk/DataCompression: DataCompression - Swift libcompression wrapper as an extension for the Data type (ZLIB, LZFSE, LZMA, LZ4, deflate, RFC-1950, RFC-1951)

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
Sources
Sources
 
 
Tests/DataCompressionTests
Tests/DataCompressionTests
 
 
.gitignore
.gitignore
 
 
DataCompression.podspec
DataCompression.podspec
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

DataCompression

A libcompression wrapper extension for the Data type

Supported compression algorithms are:
  • ZLIB deflate stream RFC-1950
  • ZLIB deflate raw RFC-1951
  • LZMA
  • LZFSE
  • LZ4
Requirements
  • iOS deployment target >= 9.0
  • macOS deployment target >= 10.11
  • tvOS deployment target >= 9.0
  • watchOS deployment target >= 2.0

Usage example

    let s = "A string that really needs to loose some weight..."
    var res: Data? = s.data(using: .utf8)

    res = res?.deflate()
    res = res?.inflate()

    res = res?.zip()
    res = res?.unzip()

    res = res?.compress(withAlgorithm: .LZFSE)
    res = res?.decompress(withAlgorithm: .LZFSE)

    res = res?.compress(withAlgorithm: .LZ4)
    res = res?.decompress(withAlgorithm: .LZ4)

    res = res?.compress(withAlgorithm: .LZMA)
    res = res?.decompress(withAlgorithm: .LZMA)

    res = res?.compress(withAlgorithm: .ZLIB)
    res = res?.decompress(withAlgorithm: .ZLIB)

    assert(res != nil)
    let t = String(data: res!, encoding: .utf8)
    assert(s == t)

Install

Cocoa Pods

To integrate DataCompression into your Xcode project using CocoaPods, add it to your Podfile:

target '<your_target_name>' do
    pod 'DataCompression'
end

Then, run the following command:

$ pod install

You then will need to add import DataCompression at the top of your swift source files to use the extension.

Swift Package Manager

To integrate DataCompression into your Xcode project using the swift package manager, add it as a dependency to your Package.swift file:

import PackageDescription

let package = Package(
    name: "<your_package_name>",
    dependencies: [
        .Package(url: "https://github.com/mw99/DataCompression.git", majorVersion: 2)
    ]
)

You then will need to add import DataCompression at the top of your swift source files to use the extension.

The next time you run swift build, the new dependencies will be resolved. Since the swift package manager still does not allow packages to define their minimum deployment target, you will have to define these on the command line. I expect this to be fixed in a future release of the swift package manager.

$ swift build -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11

Or just copy the file into your project

You only need one file located in Sources/DataCompression.swift. Drag and drop it into the Xcode project navigator.

About

DataCompression - Swift libcompression wrapper as an extension for the Data type (ZLIB, LZFSE, LZMA, LZ4, deflate, RFC-1950, RFC-1951)

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

0 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.