CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2015 |
SPMSupports SPM | ✗ |
Maintained by Josias Montag.
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.
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
println(step! + " " + percent!.description + "%: " + message!)
},
completionHandler: { (path, error) -> Void in
if(error != nil) {
println("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.
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.
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: