Search code examples
swiftparse-platformuiimageviewpffile

Convery my UIImageView to a PFFile in SWIFT


I have a UIImageView in my storyboard, and the user can successfully select an image from their phone to place in the ImageView; however, I'm not sure how to get that from the storyboard to Parse.com.

Any code would be much appreciated. There are lots of tutorials on downloading, but not saving initially.


Solution

  • You need to take the image out of the UIImageView and sage it to a PFFile.

    var file = PFFile(data: UIImageJPEGRepresentation(imageView.image, 1.0))

    Then of course, you can upload the file somewhere you choose.