         let dog = self.dogs[indexPath.row]
         
         let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")!
-//        cell.textLabel?.text = formatter.string(from: Date(timeIntervalSinceReferenceDate: dog.time))
-        cell.textLabel?.text = Formatter().string(for: Date(timeIntervalSinceReferenceDate: dog.time))
+        //        cell.textLabel?.text = formatter.string(from: Date(timeIntervalSinceReferenceDate: dog.time))
+        cell.textLabel?.text = dog.name
         return cell
     }
     

            }))
            .disposed(by: bag)
        
//        tickBtn.rx.tap
//            .subscribe(onNext: { [unowned self] _ in
//                try! realm.write {
//                    self.ticker.ticks += 1
//                }
//            })
        
        
        
        let myDog = Dog()
        myDog.name = "Rex"
        myDog.age = 1
        print("name of dog: \(myDog.name)")
        
        
        let puppies = realm.objects(Dog.self)
        //            .filter("age < 2")
        print(puppies.elements)
        print(puppies.count)
        
        try! realm.write {
            realm.add(myDog)
        }
        
        print(puppies.count)
        
        DispatchQueue(label: "background").async {
            autoreleasepool {
                let realm = try! Realm()
                let theDog = realm.objects(Dog.self).filter("age == 1").first
                try! realm.write {
                    theDog!.age = 3
                }
            }
        }
    }
    
    override func viewWillAppear(_ animated: Bool) {
        Observable.changeset(from: dogs)
            .subscribe(onNext: { [unowned self] _, changes in
                if let changes = changes {
                    self.tableView.applyChangeset(changes)
                } else {
                    self.tableView.reloadData()
                }
                
            }).disposed(by: bag)
    }
}


    
    let bag = DisposeBag()
    
    let footer: UILabel = {
        let l = UILabel()
        l.textAlignment = .center
        return l
    }()
    
    lazy var dog: Dog = {
        let realm = try! Realm()
        let dog = Dog()
        //        try! realm.write {
        //            realm.add(dog)
        //        }
        return dog
    }()
    
