Latest 0.2.1
Homepage https://github.com/DroidsOnRoids/SwiftCompressor
License MIT
Platforms ios 9.0, osx 10.11, watchos 2.0, tvos 9.0, requires ARC
Authors

Version
License
Platform

Requirements

iOS 9.0+, macOS 10.11+, watchOS 2.0+, tvOS 9.0+

Swift 3

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod "SwiftCompressor"

Usage

SwiftCompression is a Data extension. It lets you easily compress/decompress Data objects this way:

// Create NSData from file
let path = URL(fileURLWithPath: Bundle.main.path(forResource: "lorem", ofType: "txt")!)
let loremData = try? Data(contentsOf: path)

// Compress and then decompress it!
let compressedData = try? loremData?.compress()
let decompressedData = try? compressedData??.decompress()

// You can also choose one of four algorithms and set a buffer size if you want.
// Available algorithms are LZFSE, LZMA, ZLIB and LZ4.
// Compression without parameters uses LZFSE algorithm. Default buffer size is 4096 bytes.
let compressWithLZ4 = try? loremData?.compress(algorithm: .lz4)
let compressWithLZMAReallyBigBuffer = try? loremData?.compress(algorithm: .lzma, bufferSize: 65_536)

Author

Piotr Sochalewski, [email protected]

License

SwiftCompressor is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SwiftCompressor",
    "version": "0.2.1",
    "summary": "Compression framework easily",
    "description": "SwiftCompressor lets you use Compression framework easily",
    "homepage": "https://github.com/DroidsOnRoids/SwiftCompressor",
    "license": "MIT",
    "authors": {
        "Piotr Sochalewski": "[email protected]"
    },
    "source": {
        "git": "https://github.com/DroidsOnRoids/SwiftCompressor.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "9.0",
        "osx": "10.11",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "requires_arc": true,
    "source_files": "*.swift",
    "pod_target_xcconfig": {
        "OTHER_LDFLAGS": "-lcompression"
    }
}

Pin It on Pinterest

Share This