Skip to content

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

Notifications You must be signed in to change notification settings

Anagirotti/TransloaditKit

This branch is 18 commits behind transloadit/TransloaditKit:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

55f7db0 · Jun 26, 2023
Jan 18, 2023
Apr 28, 2023
Mar 2, 2023
Apr 4, 2022
Mar 2, 2023
Nov 14, 2019
Mar 2, 2023
Mar 2, 2023
Mar 2, 2023
Apr 27, 2022
Jun 26, 2023
Mar 13, 2023

Repository files navigation

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)")
    }
}

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 98.3%
  • Ruby 1.7%