我有一系列的键导致我的社交网络的帖子对象像/ posts/id /(发布信息)
当我加载帖子时,我使用observeSingleEventOfType(.Value)方法加载/发布/ 0然后/ posts/1等.
我使用lazyTableView一次加载30并且速度很慢.有没有什么方法可以使用其中一种查询方法或其他方法使其更快,即使我必须重构我的JSON树中的数据.
我来自Parse重新实现我的应用程序,到目前为止,经验非常好.只有这一点我有点坚持.在此先感谢您的帮助!
编辑:
func loadNext(i: Int) {
// check if exhists
let ideaPostsRef = Firebase(url: "https://APPURL")
ideaPostsRef.childByAppendingPath(i.description).observeSingleEventOfType(.Value, withBlock: {
(snapshot) in
if i % 29 == 0 && i != 0 && !self.hitNull { return }
// false if nil
// true if not nil
if !(snapshot.value is NSNull) {
let postJSON = snapshot.value as! [String: AnyObject]
print("GOT VALID \(postJSON)")
let post = IdeaPost(message: postJSON["message"] as! String, byUser: postJSON["user"] as! String, withId: i.description)
post.upvotes …
Run Code Online (Sandbox Code Playgroud)