Getting started with storing and retrieving images/files on parse

In 3 simple steps

MORE TUTORIALS

Pre-requisites

Import Framework

import Parse

Store Image

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()

Retrieve Image

let userImageFile = anotherPhoto["imageFile"] as PFFile

userImageFile.getDataInBackgroundWithBlock {
 (imageData: NSData?, error: NSError?) -> Void in
  if error == nil {
    if let imageData = imageData {
        let image = UIImage(data:imageData)
    }
  }
}