Swiftpack.co - transloadit/TransloaditKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by transloadit.
transloadit/TransloaditKit 3.1.0
An iOS and macOS integration for Transloadit's file uploading and encoding service
⭐️ 15
🕓 4 weeks ago
iOS macOS
.package(url: "https://github.com/transloadit/TransloaditKit.git", from: "3.1.0")

TransloaditKit

An iOS and macOS integration for Transloadit's file uploading and encoding service

Install

CocoaPods

pod 'Transloadit', '~> 3.0'

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/transloadit/TransloaditKit", .upToNextMajor(from: "3.0.0"))
]

Usage

Start by initializing Transloadit.

let credentials = Transloadit.Credentials(key: "SomeKey", secret: "SomeSecret")
let transloadit = Transloadit(credentials: credentials, session: URLSession.shared)

Create an Assembly

To create an Assembly you invoke createAssembly(steps:andUpload:completion) on Transloadit. It returns a TransloaditPoller that you can use to poll for the AssemblyStatus of your Assembly.

let resizeStep = Step(
    name: "resize",
    robot: "/image/resize",
    options: [
        "width": 200,
        "height": 100,
        "resize_strategy": "fit",
        "result": true])
        
let filesToUpload: [URL] = ...
transloadit.createAssembly(steps: [resizeStep], andUpload: filesToUpload) { result in
    switch result {
    case .success(let assembly):
        print("Retrieved \(assembly)")
    case .failure(let error):
        print("Assembly error \(error)")
    }
}.pollAssemblyStatus { result in
    switch result {
    case .success(let assemblyStatus):
        print("Received assemblystatus \(assemblyStatus)")
    case .failure(let error):
        print("Caught polling error \(error)")
    }
}

GitHub

link
Stars: 15
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

3.0.0
51 weeks ago

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