Realm accessed from incorrect thread - again : <p>I noticed many problems with accessing realm object, and I thought that my solution would be solving that.</p>

<p>So I have written simple helping method like this:</p>

<pre><code>public func write(completion: @escaping (Realm) -&gt; ()) {
    DispatchQueue(label: "realm").async {
        if let realm = try? Realm() {
            try? realm.write {
                completion(realm)
            }
        }
    }
}
</code></pre>

<p>I thought that completion block will be fine, because everytime I write object or update it, I use this method above. </p>

<p>Unfortunately I'm getting error:</p>

<pre><code>libc++abi.dylib: terminating with uncaught exception of type realm::IncorrectThreadException: Realm accessed from incorrect thread.
</code></pre>
