title: Can we generate Realm results in background queue and use it on main thread
body: <p>I'm starting using Realm recently, I'm not sure if my use case is valid:</p>
  
  <p>Normally, when reading a lot of data from DB, I want to put it in a background queue so it will async get the data and later use it on main thread.</p>
  
  <p>For example, I want to fetch several results based on city:</p>
  
  <pre><code>    private var results: [Results&lt;SomeObject&gt;?] = []
      autoreleasepool {
          DispatchQueue(label: "background").async {
              [unowned self] in
              do
              {
                  let realm = try Realm()
                  for i in 1...City.count
                  {
                      self.results.append(realm.objects(SomeObject.self).filter("city=\(i)"))
                  }
              }
              catch
              {
                  NSLog("Failed to open Realm instance on background qeueue")
              }
          }
      }
  </code></pre>
  
  <p>And later use <code>results</code> to update my chart:</p>
  
  <p><code>cell.setChartData(ChartDataFactory.createCombinedData(from: results[0]))</code></p>
  
  <p>However if I apply this model for Realm, I'm getting error like </p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread.</p>
  </blockquote>
  
  <p>I understand I must use realm for each thread, and I can do this by reading realm on main thread, but I don't want the realm query block my main thread.</p>
  
  <p>is there any way I can achieve my goal? e.g. reading realm in a background queue and access the results from another thread, while keeping the auto-refresh feature.</p>
  
  <p>Thanks.</p>