Arrays 在一个数组中使用parse server加载数据

Arrays 在一个数组中使用parse server加载数据,arrays,swift,parse-platform,Arrays,Swift,Parse Platform,我试图使用parse server加载数据,但我不知道使用哪种数组。我想要构建像snapchat这样的应用程序-用户的所有帖子都应该在一个数组中。我希望你明白我的意思 例如: userArr = [ ["name" : "Keila Maney", "pro-image" : "pro-img-3", "items": [["content" : "image", "item" : "img-3"], ["content" : "video", "ite

我试图使用parse server加载数据,但我不知道使用哪种数组。我想要构建像snapchat这样的应用程序-用户的所有帖子都应该在一个数组中。我希望你明白我的意思

例如:

userArr = [
        ["name" : "Keila Maney", "pro-image" : "pro-img-3",
             "items": [["content" : "image", "item" : "img-3"], ["content" : "video", "item" : "output"], ["content" : "video", "item" : "output2"]]],

        ["name" : "Gilberto", "pro-image" : "pro-img-1",
             "items": [["content" : "video", "item" : "output3"], ["content" : "image", "item" : "img-4"], ["content" : "image", "item" : "img-5"], ["content" : "video", "item" : "output"]]],
        ["name" : "Jonathan", "pro-image" : "pro-img-2",

             "items": [["content" : "image", "item" : "img-1"], ["content" : "video", "item" : "output2"]]],

        ["name" : "Delmer", "pro-image" : "pro-img-4",
             "items": [["content" : "image", "item" : "img-2"], ["content" : "video", "item" : "output"], ["content" : "image", "item" : "img-3"]]],

        ["name" : "Carolyne", "pro-image" : "pro-img-3",
             "items": [["content" : "video", "item" : "output"], ["content" : "image", "item" : "img-4"], ["content" : "video", "item" : "output3"], ["content" : "image", "item" : "img-3"]]],

        ["name" : "Sabine", "pro-image" : "pro-img-5",
             "items": [["content" : "video", "item" : "output2"], ["content" : "image", "item" : "img-5"], ["content" : "video", "item" : "output3"]]],
    ]
}

嗨,第一步是获得朋友列表,然后是所有朋友的帖子

您必须使用PFQuery对象和findObjectsInBackground方法请求当前用户的好友列表。在应答块中,您将收到一组PFUSER。只需运行for循环并获取所有朋友的帖子。就是这样

func getProfileTimeLine(completion:@escaping(_ posts: [Post]?, _ error:Error?)->Void){

 let query = PFQuery(className: Post.className)

 query.order(byDescending:"updatedAt")
    query.whereKey("author", equalTo: Friend)
    query.includeKey("author")
    query.limit = 20

    // fetch data asynchronously
    query.findObjectsInBackground { (friendPosts, error) in
        if error == nil{
            if let postsObjects = friendPosts{
                completion(postsObjects, error)
            }
        }else{
            completion(nil, error)
        }
    }
}

项目
集合最好与
用户
集合分开