         // Init datasource
 
         let query = database.viewNamed("chatrooms").createQuery()
+        let live = query.asLiveQuery()
+        live.descending = true
 
-        do {
-            let enumerator = try query.run()
-            rows = enumerator
-        } catch {
-            print("Could not run query")
+        liveQuery = live
+
+        // Magic line
+        live.waitForRows()
+
+        if let rows = live.rows {
+            for row in rows {
+                print(row)
+            }
+        } else if let error = live.lastError {
+            print("Error")
+            print(error)
         }
     }
 

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

        if let row = rows?.rowAtIndex(UInt(indexPath.row)),
            let name = row.key as? String {
                cell.textLabel?.text = name
        }


    var detailViewController: ChatViewController? = nil

    private var liveQuery: CBLLiveQuery?

    var database: CBLDatabase = {
        let app = UIApplication.sharedApplication().delegate as! AppDelegate
