Guest User

Untitled

a guest
Aug 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //This is my parse class
  2. let object = MYPFObject()
  3. object.data = "Hello"
  4.  
  5.  
  6. ///now when the object is saved
  7. object.saveInBackground { (success, error) in
  8.  
  9. //Here printing the object itself will give you the object ID
  10. debugPrint(object)
  11. }
  12.  
  13. <MYPFObject: 0x1c02b2660, objectId: jE01A8upDM, localId: (null)> {
  14. ACL = "<PFACL: 0x1c403f3e0>";
  15. data = Hello;
  16. }
  17.  
  18. // Create the post
  19. var myPost = PFObject(className:"Post")
  20. myPost["title"] = "I'm Hungry"
  21. myPost["content"] = "Where should we go for lunch?"
  22.  
  23. // Create the comment
  24. var myComment = PFObject(className:"Comment")
  25. myComment["content"] = "Let's do Sushirrito."
  26.  
  27. // Add a relation between the Post and Comment
  28. myComment["parent"] = myPost
  29.  
  30. // This will save both myPost and myComment
  31. myComment.saveInBackground()
Add Comment
Please, Sign In to add comment