I'm trying to upload an Image File to Parse.com from OS X using Swift. Searching the Parse.com documentation (for OS X) I found the following code:
let imageData = UIImagePNGRepresentation(image)
let imageFile = PFFile(name:"image.png", data:imageData)
var userPhoto = PFObject(className:"UserPhoto")
userPhoto["imageName"] = "My trip to Hawaii!"
userPhoto["imageFile"] = imageFile
userPhoto.saveInBackground()
The problem is that it uses UIImagePNGRepresentation(), which is from the iOS API and not OS X.
Does anyone know how to do it correctly on OS X and Swift?