0

I am having some difficulty adding a new column to my class in Parse. Currently I have made a class (named: Venue Data) with the name and geopoints of restaurants. I would like to add to that class a column for image which will be paired respective to the specific restaurant. I am quite stumped as to how I should go about it. Any help is greatly appreciated.

kRiZ
  • 2,320
  • 4
  • 28
  • 39
bantukatanaya
  • 93
  • 1
  • 10

2 Answers2

2

Parse allows you to add columns to a class lazily, meaning that you can add a field to your PFObject and if it is not present in your Parse class, Parse will add that column for you.

Here's how you would add a column via code:

// Prepare image
let imageData = UIImagePNGRepresentation(yourImage)
let imageFile = PFFile(name:"image.png", data:imageData) // "image.png" is the name which would be shown on Parse.com

// Add the new field to your object
yourObject["image"] = imageFile
yourObject.saveInBackground()

You'll notice that Parse will create a new column named image on their web portal.

kRiZ
  • 2,320
  • 4
  • 28
  • 39
0

If you log in to Parse and are in your data view ("Core" should be highlighted at the top), you should have a few options that look like this.

Click + Col and that should give you a new column to add!

If you're talking about how you would go about adding images specifically, I would store the URLs of the images as a string in Parse and load asynchronously the images in your app.

rb612
  • 5,280
  • 3
  • 30
  • 68
  • What I meant was to add the column into the class in swift. My main issue is populating the column through Xcode. Basically what I am having trouble with is adding new column information into existing PFObjects. Let's say I have (Hotel Name: A, Hotel Location: 10, 10) but i decided to add a new column. How would i append it to the existing PFObject programmatically? – bantukatanaya Jul 08 '15 at 03:21