Swift Framework for iOS and OS X
Today we are releasing the initial version of our API Wrapper for Swift. As we are using it in our iOS App for CloudConvert we thought it makes sense to publish it.
The following code snippet shows how easily it can be used. Also, we published a complete XCode Example project in the repository.
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) } })
We are looking forward to see the awesome apps you create using it!