title: How can I filter results using RxSwift, RxRealmDataSources and UISearchController?
body: <p>I am using RxSwift with RxRealm and RxRealmDataSources. My realm objects are binded to the table view. I'm trying to find a way to filter it based on query typed into search bar. Has anyone of you done sth like this?</p>
  
  <pre><code>class ItemsViewController: UITableViewController {
  
      let bag = DisposeBag()
      let searchController = UISearchController(searchResultsController: nil)
      let search = BehaviorSubject(value: "")
  
      override func viewDidLoad() {
          super.viewDidLoad()
          searchController.searchResultsUpdater = self
          definesPresentationContext = true
          tableView.tableHeaderView = searchController.searchBar
          bindTableView()
      }
  
      func bindTableView() {
          let dataSource = RxTableViewRealmDataSource&lt;Item&gt;(cellIdentifier: "itemCell", cellType: UITableViewCell.self) { cell, ip, item in
              cell.textLabel?.text = item.uuid
          }
          Observable.changeset(from: DataStore.sharedInstance.getObjects(Item.self))
              .bind(to: tableView.rx.realmChanges(dataSource))
              .addDisposableTo(bag)
      }
  
  }
  
  extension ItemsViewController: UISearchResultsUpdating {
  
      public func updateSearchResults(for searchController: UISearchController) {
          search.onNext(searchController.searchBar.text ?? "")
      }
  
  }
  </code></pre>