Performance issue during insertion of document to collection between Android and iOS

My apologies but I am struggling trying to understand what you’re attempting to do with that code.

The .create function creates a single realm object so this

.create([RLMIngredient].self

won’t work as [].self is an array and not a Realm object. It’s unclear what the purpose of that would be even if it did work.

Why? Why do you need an array of dictionaries for? Where does data come from? Is it encoded? Why not just pass data to a Realm object when it’s instantiated, let the object decode it and assign properties and then write it out to Realm?


Your new question is

And the answer is you cannot insert and array of json objects to Realm. You can only insert Realm objects into Realm.


I feel the thread is getting off topic.

The initial issue was Realm write performance. Using my examples above, we’re not able to replicate that issue which would indicate the problem lies elsewhere in your code that was not included.

Working with JSONSerialization, arrays etc are off topic for this discussion and to prevent the thread from being a mile-long, it should probably be posed as another question (it’s really a separate topic)

Happy to help but it’s important to keep threads on a single topic so it may help future readers that are looking for help about this particular subject matter.

So, post a separate question with the code you’re stuck on an we’ll take a look!