CloudConvert API Swift Wrapper.
Swift Ruby Objective-C
Latest commit 7fa96e2 Aug 29, 2016 @josiasmontag josiasmontag new upload method
prepares uploading of multiple input files
Permalink
Failed to load latest commit information.
CloudConvert.xcodeproj swift 2 support #1 Nov 30, 2015
CloudConvert new upload method Aug 29, 2016
CloudConvertExample upgrade to Alamofire 3.4 Aug 29, 2016
CloudConvertTests
.gitignore remove Pods from repository Aug 29, 2016
CloudConvert.podspec upgrade to Alamofire 3.4 Aug 29, 2016
LICENSE add LICENSE because CocoaPods forces us to do so Apr 13, 2015
README.md

README.md

cloudconvert-swift

This is a lightweight wrapper for the CloudConvert API, written in Swift. It is compatible with iOS 7.0+ / Mac OS X 10.9+ and requires Xcode 6.3.

Feel free to use, improve or modify this wrapper! If you have questions contact us or open an issue on GitHub.

Quickstart

import CloudConvert

CloudConvert.apiKey = "your_api_key"

let inputURL = NSBundle.mainBundle().URLForResource("file",withExtension: "png")!
let outputURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as? NSURL

CloudConvert.convert([
                    "inputformat": "png",
                    "outputformat" : "pdf",
                    "input" : "upload",
                    "file": inputURL,
                    "download": outputURL
                ],
                progressHandler: { (step, percent, message) -> Void in
                    print(step! + " " + percent!.description + "%: " + message!)
                },
                completionHandler: { (path, error) -> Void in
                    if(error != nil) {
                        print("failed: " + error!.description)
                    } else {
                        println("done! output file saved to: " + path!.description)
                    }   
            })

You can use the CloudConvert API Console to generate ready-to-use Swift code snippets using this wrapper.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

gem install cocoapods

To integrate CloudConvert into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'CloudConvert', '~> 1.0'

Then, run the following command:

pod install

Manually

If you prefer not to use CocoaPods, you can integrate CloudConvert into your project manually. As CloudConvert depends on Alamofire, you need to add Alamofire.swift to your Xcode Project first. Afterwards you can add the CloudConvert.swift Source file.

Note that any calling conventions described in this README with the CloudConvert prefix would instead omit it (for example, CloudConvert.convert becomes convert), since this functionality is incorporated into the top-level namespace.

Example Project

It is a good starting point to have a look at the CloudConvert Example project in this repository. It shows how to find possible conversion types, start and monitor a conversions and how to cancel a conversion.

To open the project:

  • Checkout (or download) this repository
  • Execute pod install in the CloudConvertExample folder
  • Open CloudConvertExample.xcworkspace in the CloudConvertExample folder with Xcode

Resources