Skip to content
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
@ShawnBaek

Description

@ShawnBaek

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions