Skip to content

Instantly share code, notes, and snippets.

@superarts
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superarts/6786c583a63c5a7dfa6b to your computer and use it in GitHub Desktop.
Save superarts/6786c583a63c5a7dfa6b to your computer and use it in GitHub Desktop.
MBProgressHUD+Parse
let obj = PFObject(className: "sg_text")
obj.setObject(text_view!.text, forKey: SG.const.text)
MBProgressHUD.show("Analyzing...", view:view)
obj.saveInBackgroundWithBlock({
(success: Bool?, error: NSError?) in
MBProgressHUD.hideAllHUDsForView(self.view, animated:true)
if error == nil {
LF.log("TEXT saved", obj)
} else {
MBProgressHUD.show(error!.localizedDescription, view:self.view, duration:2)
}
})
var query = PFQuery(className: "sg_question")
MBProgressHUD.show("Initializing...", view:view)
query.getObjectInBackgroundWithId(question.objectId, block:{
(object: PFObject?, error: NSError?) in
MBProgressHUD.hideAllHUDsForView(self.view, animated:true)
if error == nil {
LF.log("QUESTION loaded", object)
} else {
LF.log("QUESTION failed", error)
MBProgressHUD.show(error!.localizedDescription, view:self.view, duration:2)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment