This repository was archived by the owner on Jun 13, 2023. It is now read-only.
This repository was archived by the owner on Jun 13, 2023. It is now read-only.
I'm using in tableview with swift3. Could you anyone some helps me? #85
Closed
Description
Hi I'm trying to use live query.
My question is really simple. Could you please let me know how do I use that?
My original code is here
in Tableviewcontroller
loadPost(){
blah blah~~~
//Get All of Post
let postQuery = PFQuery.orQuery(withSubqueries: [friendsPostQuery, myPostQuery, sellPostQuery])
postQuery.includeKeys(["postBy", "comment", "comment.commentBy"])
postQuery.limit = self.page
postQuery.addDescendingOrder("createdAt")
postQuery.findObjectsInBackground { (objects:[PFObject]?, error:Error?) in blah blah~~~
}
I want subscribe of postQuery.
So I changed my code like this
Step 1. Make "Post" Class
class Post: PFObject, PFSubclassing
Step 2. declare subscription variable in tableviewcontroller and postQuery variable.
var postQuery: PFQuery? {
return Post.query()?
.whereKey("hi", equalTo: "Something")
<-- How do I set like loadPost()?
}
//Post Subscription
private var subscription: Subscription<Post>?
Could you please let me know some guide?
And Can I use live query with swift3?
Metadata
Metadata
Assignees
Labels
No labels