# TransloaditKit

[transloadit/transloaditkit](https://github.com/transloadit/transloaditkit)

Mit CocoaPods oder Carthage können Sie Transloadit ganz einfach in Objective-C und Swift einsetzen und Uploads sowie Encoding in macOS- und iOS-Apps nutzen.

## Installation

### CocoaPods

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_3z41v8VuCJJKgtsQfSKB6o2uiSXL)

```ruby
pod 'Transloadit', '~> 3.0'

```

### Swift Package Manager

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_3z41v8VuCJJKgtsQfSKB6o2uiSXL)

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

```

## Verwendung

Initialisieren Sie zunächst `Transloadit`.

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_3z41v8VuCJJKgtsQfSKB6o2uiSXL)

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

```

### Eine Assembly erstellen

Um eine `Assembly` zu erstellen, rufen Sie `createAssembly(steps:andUpload:completion)` für `Transloadit` auf. Die Methode gibt einen `TransloaditPoller` zurück, mit dem Sie den `AssemblyStatus` Ihrer `Assembly` abfragen können.

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_3z41v8VuCJJKgtsQfSKB6o2uiSXL)

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

```

## Dokumentation

Die vollständige Dokumentation finden Sie auf [GitHub](https://github.com/transloadit/TransloaditKit#readme).
