Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is my parse class
- let object = MYPFObject()
- object.data = "Hello"
- ///now when the object is saved
- object.saveInBackground { (success, error) in
- //Here printing the object itself will give you the object ID
- debugPrint(object)
- }
- <MYPFObject: 0x1c02b2660, objectId: jE01A8upDM, localId: (null)> {
- ACL = "<PFACL: 0x1c403f3e0>";
- data = Hello;
- }
- // Create the post
- var myPost = PFObject(className:"Post")
- myPost["title"] = "I'm Hungry"
- myPost["content"] = "Where should we go for lunch?"
- // Create the comment
- var myComment = PFObject(className:"Comment")
- myComment["content"] = "Let's do Sushirrito."
- // Add a relation between the Post and Comment
- myComment["parent"] = myPost
- // This will save both myPost and myComment
- myComment.saveInBackground()
Add Comment
Please, Sign In to add comment